Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

echo smbpasswd by --stdin doesn't work

I want to make creating a samba password automated but this command doesn't work:

echo "passwd"|smbpasswd -a -s $user

It shows this error:

Mismatch - password unchanged. Unable to get new password.

Could you please suggest any option to make my script automated?

like image 443
sunil Avatar asked Jul 24 '10 05:07

sunil


1 Answers

You need to repeat the password, "for confirmation" so to speak, so e.g.

printf "passwd\npasswd\n" | smbpasswd -a -s $user

should work.

like image 127
Alex Martelli Avatar answered Sep 25 '22 22:09

Alex Martelli