[Samba] Adding samba users via a script
Matt Easton
matthew at sublunar.com
Sun Jul 17 18:23:57 GMT 2005
On Jul 15, 2005, at 5:28 PM, jools wrote:
> Hi all,
>
> I have a script that I wish to implement for adding users and samba
> users in
> bulk. I'm running Samba 3.0.13 on Mandriva LE2005 although the script
> dates
> back to samba 2 days.
>
> The script works by reading the user's name, password and group from a
> text
> file, first generating Unix user accounts and then running:
>
> /usr/bin/smbpasswd -a -s $user $pwd > /dev/null
>
> to add the smb accounts. The -s switch should allow the Samba password
> to
> pulled from stdin instead of a prompt but the scipt just exits at the
> point
> of attempting the creation of the first Samba account . Is there any
> difference between Samba 2 and Samba 3 that would explain this?
>
On my RedHat ES 3 system, running 3.09 or so I recall, smbpasswd -s
means silent, but it still expects the password confirmation. Perhaps
you could make a here document
#!/bin/bash
#create unix user
/usr/sbin/useradd -s /bin/false (etc,etc) -p $password $user
#create samba user
/usr/bin/smbpasswd -a -s $user <<LimitString
echo $password
echo $password
LimitString
More information about the samba
mailing list