dockur / samba

Samba SMB server in a Docker container.
MIT License
149 stars 19 forks source link

Issue updating password of an existing user #9

Open RenanGreca opened 6 months ago

RenanGreca commented 6 months ago

Hi, first of all thanks for this repo, it's exactly what I'm looking for :)

However, I'm having an issue with the credentials. I'm running the container using compose. After having running it once with the default credentials, I tried changing the password with no luck. I tried both the secret method and the environment method. After cleaning and restarting the container, I saw that the $PASS env var is correctly set inside the container, however I can't log into the SMB server anymore with the new or old password.

After some experimentation, I found out that if I also change the $USER variable, I can use the new password with it. But if I don't change $USER, it seems that the credentials are completely invalidated. And if I change $USER to a value it has had previously, it also doesn't work.

I've tried removing the container, removing the image, removing the volumes and somehow this history of invalid users persists.

kroese commented 6 months ago

Strange problem! When I have time I will see if I can reproduce it, but at first sight when looking at the code, I dont see any obvious mistake.

The line responsible for setting the password is:

echo -e "$PASS\n$PASS" | smbpasswd -a -c "$config" -s "$USER"

And this is always executed when starting the container, and according to its manual the -a option should either add OR update the password for that user.

So I dont have any good explanation why this doesnt work in practice, because in theory it looks correct.

RenanGreca commented 6 months ago

I'll also keep cracking away at it when I get the chance, I'll update here if I find out anything!

kroese commented 1 month ago

Maybe this is fixed now because of some rewrites related to https://github.com/dockur/samba/pull/14

RenanGreca commented 1 month ago

Thanks for the heads up @kroese, I'll give it a shot and update here later.

100730088 commented 4 weeks ago

Thanks for the heads up @kroese, I'll give it a shot and update here later.

Are you OK? Today, I having this issue too.

JBlond commented 7 hours ago

I wonder if you can try

docker compose exec -it samba bash
pdbedit -a -u USER2