samba icon indicating copy to clipboard operation
samba copied to clipboard

Issue updating password of an existing user

Open RenanGreca opened this issue 1 year ago • 4 comments

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.

RenanGreca avatar May 06 '24 16:05 RenanGreca

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.

kroese avatar May 06 '24 16:05 kroese

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

RenanGreca avatar May 06 '24 16:05 RenanGreca

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

kroese avatar Oct 09 '24 20:10 kroese

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

RenanGreca avatar Oct 10 '24 12:10 RenanGreca

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.

100730088 avatar Oct 16 '24 14:10 100730088

I wonder if you can try

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

JBlond avatar Nov 14 '24 20:11 JBlond