Help on Add User Scripts

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Help on Add User Scripts
# 1  
Old 05-03-2011
Help on Add User Scripts

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
for each user
Create a account formatted as last name first initial. Example (southerm)
Ensure no duplicate usernames
Create the password. (first initial, last initial, last four of the id or ss#) example (ms0000)
Add the user - be sure to include the appropriate group.
Set the password
Add the user to samba and set the password.
create a directory in the appropriate www directory.
change the owner and group the new directory


2. Relevant commands, code, scripts, algorithms:
As far as adding the user, there is a file that is formatted with commas with lists of last names, first names, and ss#.
Example:
LastName, FirstName, SS#
Jones,Linda,002343256
Henry,John,213565897
etc.


3. The attempts at a solution (include all code and scripts)
I know most of the commands applicable for the script I think, I am having trouble putting it all together.

So for example, after the file name is read in as a argument in the the script, i would use

cut -f 1 -d "," students.csv (or $1 for the argument) | tail -n +2 | head -1
(I understand this cuts out the last name on the second line of the file excluding the header)

cut -f 2 -d "," students.csv (or $1 for the argument) | tail -n +2 | head -1 | cut -c 1
(I understand this cuts out the first letter of the first name on the second line of the file excluding the header)

I would guess these should be redirected to temp files and the head and tail values would have to change according to an expression so they would be set as variables as well. I also see it in a loop so that every line of the file gets processed one after another. I honestly do not know how to check for duplicates usernames, i know that it does involve the passwd file and checking it within the script. I also know that the useradd -g command will be utilized to add the users to the appropriate groups. The Chown command will be utilized to change the owner of the samba groups. I really need some help putting this all together. I have tried and need guidance from someone more skilled in linux scripting so I can understand how to put it together. All help is very appreciated guys.


4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Wilkes Community College, Wilkesboro, NC, Michael Souther, NOS 221 Linux/UNIX Admin ll http://www.wilkescc.edu/default2.aspx?id=8492 (the course is listed here under Networking Technology C25340Land if you need further information please ask)


Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Is there a way to restrict a user (owner) to execute scripts from a specific directory

Hello, I have a user Bob on a RHEL 7 server1. Where his script area is "/home/Bob/scripts/" and he is the owner for this directory. On the server1, there is a NFS mount from another server2, with path as "/global/work/" and Bob is the owner for this directory too in server2. (Same UID and GID... (5 Replies)
Discussion started by: karumudi7
5 Replies

2. Shell Programming and Scripting

interactive scripts with user input that includes quotes

I'm writing a basic ldapsearch script that prompts the user for their search criteria. The input they're being asked for is the search filter portion of the ldapsearch command. This string must be quoted. When the script executes the command it returns nothing. If I hard code a search filter it... (1 Reply)
Discussion started by: donniemac
1 Replies

3. Shell Programming and Scripting

set only some command & scripts permission to a particular user

hi, i am new in unix.......i am using bash and i want to create a user which has only some command and scripts permission.........is it possible? thanx (1 Reply)
Discussion started by: rakeshtomar82
1 Replies

4. Shell Programming and Scripting

Write a scripts to kill idle user for 60 min. & email user list to admin in text file

Folks, I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3) List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
Discussion started by: sumit30
4 Replies

5. Shell Programming and Scripting

Add 5 lines of code to all the scripts in a directory

Hi Guys, I need some tips on writing a Korn shell script that would look for certain lines of code and replace all the scripts in the directory with a few other lines. I have about 120 scripts that I need to modify. Any suggestions would be appreciated! Thanks, Cool_avi (5 Replies)
Discussion started by: coolavi
5 Replies

6. Web Development

User authentication for some Perl CGI scripts

Hi, I am trying to create a web interface with Perl CGI with 2 pages. The content of these pages is dependent on the user accessing it. Thus, I need some kind of authentication to identify WHO is logging in but I DO NOT WANT to be restricting the pages to a few. What is the best way to prompt... (8 Replies)
Discussion started by: garric
8 Replies

7. Shell Programming and Scripting

How should I add a timeout to my scripts?

I am running several tcsh scripts in the crontab of my workstation for acquiring, processing and visualizing data. Some of the quicklooks generated by these scripts are automatically copied to an intranet page. However, I just found out that I have currently about 50 (old) scripts still running... (1 Reply)
Discussion started by: SharkM
1 Replies

8. Shell Programming and Scripting

Check if script run by a user directly or via other scripts

Hi, i have a script 'a.sh' that should be called only by certain scripts like b.sh, c.sh Inside a.sh, how can i determine 1) if this script was run directly from command prompt (or scheduler) 2) if called via other scripts? Is there an easy way to get parent process name (not just pid),... (2 Replies)
Discussion started by: ysrinu
2 Replies

9. Shell Programming and Scripting

How can I make running gawk scripts more user-friendly in a Windows environment?

I know, and I apologise for using the W word, but I have users asking if they can use my gawk scripts, but I just know they're not going to like using the DOS command line. Is there any way for me to run my gawk scripts from a gui? Even if it's from a web page (html, php, what ever). I do not... (3 Replies)
Discussion started by: jonathanm
3 Replies

10. UNIX for Dummies Questions & Answers

How to add email notification in scripts?

Hi. I want to add email notification so when the my script finishes it sends out an email of the results to our team. If there are errors the subject on the email should say there were errors. If any having idea/sample scripts pls share with me. (2 Replies)
Discussion started by: redlotus72
2 Replies
Login or Register to Ask a Question