Try this. hope it works.

1) create a list of users in this format. call it myusers. /path/to/home/of/user should be existing. This is where you can play with the home directory structure.

<User's Name1>,</path/to/home/of/user1,<userid1>,defaultpass
<User's Name2>,</path/to/home/of/user2,<userid2>,defaultpass

2) copy the bash script below. its not perfect so modify it to fit your need or style or if there are bugs. call this script as addmyusers. dont forget to chmod +x addmyusers.

#!/bin/bash
cat myusers | while read DUSER
do
FNAME=$(echo $DUSER | cut -d\, -f1)
THEPATH=$(echo $DUSER | cut -d\, -f2)
THEUSER=$(echo $DUSER | cut -d\, -f3)
DEFAULTPASS=$(echo $DUSER | cut -d\, -f4)
useradd -c $FNAME -d $THEPATH $THEUSER
echo "$DEFAULTPASS" | passwd --stdin $THEUSER

#uncomment this if user needs samba
#(echo "$DEFAULTPASS"; echo "$DEFAULTPASS") | smbpasswd -a -s $THEUSER
done

3) put this files in one folder and run it this way

./addmyusers myusers




On 7/7/06, [K][R][Y][P][T][O][N] < [EMAIL PROTECTED]> wrote:

Good day to all,

I'm still in search for a script that will generate multiple user accounts
with a defined work directory. Although I tried using the scripts using
previous posts still it doesn't work. Anyway can anyone give me a good site
or even a simple script I could work with. Thanks nga pala kay VERTITO sorry
I can't make your script work. I just need this so bad.

Thanks and again MORE POWER TO PLUG!.


_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph



--

Regards,

Martin Acupanda
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph

Reply via email to