LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-03-2008, 06:17 PM   #1
aapanju
LQ Newbie
 
Registered: Mar 2008
Posts: 26

Rep: Reputation: 15
Creating A Linux Script To Add Sequential Users.


I need a script to create 400 users with serial numbers starting from 001 all the way to 400. They have to have UID 3001 to 3400 and all shud be in GID 9999. home directories should be /home/user001 all the way to /home/user400 and have a password expiery of 28 days. Either a script or any help would be great. Thanks
 
Old 03-03-2008, 07:08 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by aapanju View Post
I need a script to create 400 users with serial numbers starting from 001 all the way to 400. They have to have UID 3001 to 3400 and all shud be in GID 9999. home directories should be /home/user001 all the way to /home/user400 and have a password expiery of 28 days. Either a script or any help would be great. Thanks
is this homework? for fear that it is, check out "man adduser"

you'll notice that all the options you need are there.

after that, you'll just need a little loop, kinda like (pseudo-esque code):

Code:
for i in 1 to 400
  $ii = $i +3000
  adduser <options>
end
being that you have $i going from 1-400 and $ii going from 3001-3401, it should be straight forward to see how to put this all together.

test with echos before you acually do it, i.e. instead of the adduser line, do something like

echo "adduser <options>"

and see that it prints out the command correctly.

Good luck!
 
Old 03-03-2008, 07:49 PM   #3
aapanju
LQ Newbie
 
Registered: Mar 2008
Posts: 26

Original Poster
Rep: Reputation: 15
hey brianK, anyway you can write the script if its a 5 or 6 line script. Its an assignment, I dont have to do it with a script Im supposed to make 400 users on fedora, either with script or manually... if i do it manually itll take ages .. so yea a script would be great .. please just post something to let me know if you can help me or not because than ill just leave and go home an giveup on this. Thanks bro.
 
Old 03-03-2008, 07:51 PM   #4
aapanju
LQ Newbie
 
Registered: Mar 2008
Posts: 26

Original Poster
Rep: Reputation: 15
oh yeah and sorry for creating the second thread.. desperation makes you do crazy things...
 
Old 03-03-2008, 09:22 PM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,898
Blog Entries: 27

Rep: Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185
Hi,
Quote:
Originally Posted by aapanju View Post
oh yeah and sorry for creating the second thread.. desperation makes you do crazy things...
Maybe the desperation should get you to do your own homework. It is assigned to you for a reason. I would suggest that you read the LQ Rules.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating new users in linux without using addmod or user add frankthetank250 Linux - Newbie 5 10-29-2007 03:24 AM
Creating new users in linux without using addmod or user add frankthetank250 Linux - Newbie 1 10-28-2007 10:02 PM
creating sequential child processes using fork() BrokenFighter Programming 1 03-06-2007 11:11 PM
Creating users in a script Reeonimus Linux - General 1 06-20-2006 03:08 PM
Creating users with a script 80s Linux - General 3 01-13-2003 01:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration