Echo smbpasswd by --stdin not working

I want to make the samba password automatically generated, but this command does not work:

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

It shows this error:

Mismatch - the password has not changed. Failed to get new password.

Could you offer any opportunity to make my script automatic?

+6
scripting shell
source share
1 answer

You need to repeat the password "for confirmation", so to speak, for example,

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

must work.

+12
source share

All Articles