[K12OSN] Smbldap-bulk-useradd change password encryption

Les Mikesell les at futuresource.com
Fri Aug 12 20:04:40 UTC 2005


On Fri, 2005-08-12 at 14:48, Jim Kronebusch wrote:
> > Anyone know what switches to add to smbpasswd so that I can 
> > do something like "smbpasswd username passwd" and not have it 
> > prompt me for a password?
> 
> Okay, I figured out the syntax I need.  
> 
> # (echo $password;echo $password) | smbpasswd -s $username
> 
> Now if anyone can help me with a script that would parse a file called
> userpasswords in the format of username,password and do something like
> for everyline in userpasswords set $username as username and $password
> as password and then run the above command I would be set.

You have to show the file format if you want help parsing it.  If it
is
username password
with whitespace between you can:

while read username password
do
(echo $password;echo $password) | smbpasswd -s $username
done < file

You can fiddle with IFS to split on something other than whitespace
and use dummy variables to offset the position but it's probably
easier to let sed convert to the format above and pipe to the
loop.

-- 
  Les Mikesell
   les at futuresource.com





More information about the K12OSN mailing list