How can I pipe the new password to smbpasswd so I can automate my installation process.
Thanks to Mark I found the answer:
(echo newpassword; echo confirmNewPassword) | smbpasswd -s
BTW: (echo oldpasswd; echo newpasswd) | smbpasswd -s does not work.
I use the following in one of my scripts:
echo -ne "$PASS\n$PASS\n" | smbpasswd -a -s $LOGIN
With echo:
-e : escape sequences, like \n
-n : don't add implicit newline at end
With smbpasswd:
-a : add new user
-s : silent
Try something like this:
(echo oldpasswd; echo newpasswd) | smbpasswd -s
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With