Computing.Net > Forums > Unix > I'm a beginner

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

I'm a beginner

Reply to Message Icon

Name: harry
Date: October 22, 2002 at 08:51:26 Pacific
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




Sponsored Link
Ads by Google

Response Number 1
Name: Sean Miller
Date: October 26, 2002 at 01:44:32 Pacific
Reply:

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.

Good luck,

Sean


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: I'm a beginner

A BEGINNER'S PLEAD www.computing.net/answers/unix/a-beginners-plead/3150.html

Scripting question (beginner) www.computing.net/answers/unix/scripting-question-beginner/5558.html

How to write a korn shell script www.computing.net/answers/unix/how-to-write-a-korn-shell-script/3643.html