creating batch file for logon script...

Mark Montazer mdmontazer at
Tue Sep 25 10:35:04 GMT 2001

Here's a script I use, granted, there's no error checking and you have to
remember the parameters, but time is short and bosses don't ever see the
usefulness of such things.  Just plop it in /usr/sbin or wherever your path
points, and it'll do the rest for you.  I call it adddomuser:

------------------------begin script--------------------------

useradd -c "$1 $2 $3" -d /home/$4 -g $5 -s /bin/bash $4

# format: First Name, Middle Initial, Last Name, username, group

echo "net time \\\siddhartha /set /yes" > /usr/local/samba/netlogon/$4.bat
echo "net use h: \\\siddhartha\\$4" >> /usr/local/samba/netlogon/$4.bat
echo "net use i: \\\siddhartha\\$5" >> /usr/local/samba/netlogon/$4.bat
echo "net use j: \\\siddhartha\\confluence" >>

unix2dos /usr/local/samba/netlogon/$4.bat
chmod 777 /usr/local/samba/netlogon/$4.bat

smbpasswd -a $4
----------------------end script--------------------------------


-----Original Message-----
From: samba-admin at [mailto:samba-admin at]On
Behalf Of Sano B Rutsen
Sent: Tuesday, September 25, 2001 11:56 AM
To: samba
Subject: Re: creating batch file for logon script...

I agree with you, but then im planning to write a script that would
automate the creation of the batch file, so that every time I have
to add a user i dont have to manually create the file in notepad for
all the users, just to copy it to the linux box.

This way everytime i add a user for samba, a dos formatted script is
automatically created without leaving my linux box,(very convenient if
I have many users).

But then again, I can see your point. Im doing this for a home network
with no more than 20 users... hehe... Anyways, i like doing things
for fun.


Best Regards,


=?iso-8859-1?Q?Wilmar_P=E9rez?= wrote:

>Hi Sano
>Well, your friend's right.  But you don't need any other program.  You
>just've got to edit the file in a DOS or Windows plain text editor and the
>send it to the Linux box, that's it.


To unsubscribe from this list go to the following URL and read the

More information about the samba mailing list