Name: harry Date: October 22, 2002 at 08:51:26 Pacific Subject: I'm a beginner OS: unix CPU/Ram: n/a
Comment:
i'm needing help making unix accounts i'm a student and i've found out how to make regular accounts in unix but i need to use this page to go by.: --------------- Create a script to create user accounts and passwords from a file of student information. The script should echo to the screen the useradd command that would create the account and a line below it with the password for all records in the file. Example: useradd -d /export/home/smithj -m -k /etc/myskel -g 100 -u 1089 -s /bin/ksh smithj smithj password is: 6789 Student Information File Records are as follows:
LastName, FirstName MiddleName T Date Major PhoneNumber SSNumber 1111111112222222222333333333344444444445555555555666666666677777777778 12345678901234567890123456789012345678901234567890123456789012345678901234567890 SMITH, JOHN JAY R 06/25/02 A2526D 336-667-1234 123456789 DOE, JANE MARY A 06/30/02 A2526E 336-667-5678 987654321
Account Names must adhere to the following rules;
Accounts must be 8 letters or less. Accounts must be all lower case. Account names can not be duplicated. An account should have a unique UID Accounts will have the same GID Account Naming Nomenclature. Accounts in general will be Last Name and First Inital. example smithj If Last Name equals 8 Characters then the last Name will be the account name. example: roberson If account Last Name is longer than 8 Characters then account will be the first 8 letters of the last name. example abernathy will be abernath Duplicate account names will have the last letter of the account replaced by a number. example a second smithj would become smith1 Passwords will be set to the last 4 digits of the users Social Security Number. Now we can create the account using the useradd command. The syntax of user add is: useradd -d home_directory -m -k path_to_skel_profile -g groupid -u userid -s shell account_name -d is the home directory path -m says create it. -k is the path to any skeleton profiles such a .profile -g assigns the group ID -u assigns the user ID -s is the default shell example: /bin/ksh account_name would be like smithj Your Script will need to pull the last UID from /etc/passwd and pass in the GID. The default shell will be /bin/ksh The home directory will be /export/home/account_name The skeleton profile is in /etc/myskel -------------- can someone please get me started. thanks
What they're wanting you to do is read in each line of the student file, extract the relevent data and then output the useradd command and what the password would be.
Doesn't sound too scary... the cut and awk utilities would seem like quite a good place to start.