Change user password in samba server with the pdbedit tool

Lothar picture Lothar · Feb 9, 2012 · Viewed 15k times · Source

I am trying to change user password with script but I'm having trouble using the -t option. Here's what I try:

echo -e "12345\n12345\n" | pdbedit -t -u username

So this is wrong somehow. Any ideas what I am missing or what should I try?

Answer

raph picture raph · Oct 2, 2012
$ printf "%s\n%s\n" pwd pwd|pdbedit -t -r -u user

does not appear to work either

According to http://git.samba.org/?p=samba.git;a=blob;f=source3/utils/pdbedit.c the --password-from-stdin parameter (pw_from_stdin) only affects account creation.

Thus, you'll rather prefer smbpasswd

$ printf "%s\n%s\n" pwd pwd|smbpasswd -s user

( Piping password to smbpasswd )