[Samba] Timing in a script

Michal Dobroczynski michal.dobroczynski at gmail.com
Fri May 15 14:18:03 GMT 2009


Hello,
useradd -c "User Name" -g groupname -p unixpassword accountname
sleep 5s
echo -e "smbpassword\nsmbpassword\n" | pdbedit -a -t -u accountname

Did you want something like that?

Regards,
Michal

PS I am using such a trick to make sure LDAP data is distributed among
replicas, so that other distributed file servers have specified users
when they ask for them...


2009/5/15 Pete Clapham <peteclapham at sbcglobal.net>:
> Hi, all --
>
> I am trying to write a script in which I can add users and their samba passwords easily and quickly.  It looks something like:
>    useradd -c "User Name" -g groupname -p unixpassword accountname
>
>    echo -e "smbpassword\nsmbpassword\n" | pdbedit -a -t -u accountname
>
> If
> I type the lines from the keyboard, it works fine.  However, when I try
> to execute the script, the pdbedit on the second line reports that
> there's no unix accountname to apply to samba.  I assume that this is
> because the useradd process hasn't finished when the pdbedit is
> executed.
>
>
> Is there a way to insure that the useradd has completed its
> execution before the pdbedit starts?  Alternatively is there a way to
> insert a delay between the two commands to allow the useradd to
> complete?
>
> Thanks.
>
>
> cheers,
> pete
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
>


More information about the samba mailing list