How can I pipe the new password to smbpasswd so I can automate my installation process.
Try something like this:
(echo oldpasswd; echo newpasswd) | smbpasswd -s
@mark I am getting this:
Mismatch - password unchanged.
Unable to get new password.
Thanks to Mark I found the answer:
(echo newpassword; echo confirmNewPassword) | smbpasswd -s
BTW: (echo oldpasswd; echo newpasswd) | smbpasswd -s does not work.
@unk
what happens when you run
smbpasswd -s
by itself, and you type in from the keyboard?
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
" echo -ne "$PASS\n$PASS\n" | smbpasswd -a -s $LOGIN "
Thanks for this suggestion, it's works fine in my script! Jvonne
Hi, can anyone suggest me a command to add samba user? I want add samba user through php in one single command by avoiding password prompt. " echo -ne "$PASS\n$PASS\n" | smbpasswd -a -s $LOGIN " this command says "Failed to modified password entry for user $username" because im trying to add a user. Can anyone help me? Thanks.