Search code examples
bashsambachange-password

Change user password in samba server with the pdbedit tool


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?


Solution

  • $ 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 )