I am new to linux but i started with admin work and setting up a samba server for 500 users.
I got the basics of this script from this site, i think, and edited it to suit me.
1. Created the groups that i wanted
2. Created Home and subHome directories eg. /home/finance /home/accounts
3. Created a .csv file from OOo or Excel with the seperator being SPACE not Comma. By WORK AREA I assume you mean UNIX GROUP. I put the names file in the /home dir hence the "/home/names" in the script.
USER FNAME LNAME PASS WKAREA
joeb Joe Black leu2dsfr test
jackw Jack White Xahsei6i finance
4. Created the script below. call it addusers or what ever you want. save it in /home or where ever you want.
#!/bin/bash
NEW_USERS="/home/names"
cat ${NEW_USERS}|\
while read USER FNAME LNAME PASS WKAREA
do
adduser ${USER} -c "${FNAME} ${LNAME}" -g ${WKAREA} -d /home/${WKAREA}/${USER} -p ${PASS}
done
5. open terminal and cd to the directory where the script is
~ bash addusers
I did not use the password part because i was setting up samba users not unix users. Users had to log on to samba server (linux) from a Win98 PC, but i believe that is how the password should be entered. Not too sure of the confirm password request will work. If it doesn't try without the -p in the script
Test with just one or two users. If the script runs ok and the user and directories created, logoff and login to test the password part.
Remember:
I used Fedora 2 for this,
you may need to try adduser or useradd,
need to be root - not too sure if su will work.
I did this some while ago and I am trying to remember and be as clear as i can. Change to suite your needs.
This site has helped me so very much that if i think i might be able to help i will offer. I am NO EXPERT.
EXERCISE CAUTION
|