[Samba] migrate existing Unix password to sambapassword

Paul Gienger pgienger at ae-solutions.com
Fri Jul 22 13:17:00 GMT 2005


> Considering we have more than 500 users, I still
> wonder if there is a way I can populate their Samba
> entries automatically and quickly -- even the value of
> SambaPasword is set to be temporary and is different
> from the correpsonding userPassword. smbpasswd command
> seems only can be used at interactive mode.

That is true, there used to be a flag to allow you to specify the password
as an argument but that is no longer there.  That being said, there are ways
to get it to be scripted.  

Here the essence of a line I use in my automatic useradd script to get it
done.  This is valid bash once you replace the <>'s.  I have it in perl with
``, yes there's probably better ways, but this is mine.

(echo <password variable>; echo <password variable>) | <path to smbpasswd>
-s -a <username>



More information about the samba mailing list