LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 05-30-2007, 12:53 AM   #1
b3ckham88
LQ Newbie
 
Registered: May 2007
Posts: 4

Rep: Reputation: 0
Urgent help in scripting to create multiple user account in suse linux


Hi people, i'm in need of serious help asap in regard of creating multiple user account like for example of 100 user account using loops in a script to create. Can anyone help me asap. Thanks.
 
Old 05-30-2007, 01:24 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
Well, I'm not sure anyone here is willing to actually do the work for you, since linuxquestions is here to answer questions.

Maybe you could show us the script you have so far, and ask us questions about where you got stuck.

Hope this helps.
 
Old 05-30-2007, 02:08 AM   #3
b3ckham88
LQ Newbie
 
Registered: May 2007
Posts: 4

Original Poster
Rep: Reputation: 0
for i in `seq 1 100`;
do
useradd user$i
done

for example something like this, would be able to work am i right ? In this case the password after that should i go yast and set something on it, but end of the day i just hope to know if this above code do really work, thanks
 
Old 05-30-2007, 02:08 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
There's some good stuff about shell scripting, among other things, at linuxcommand.org so read there if you are unsure about commands. Basically to add a user to the system you can use ready scripts (can be tricky to script to use a script to add the user) or just modify three files: /etc/passwd, /etc/shadow and /etc/group (first one: user information, NO password, second: encrypted password and some information, third: group information). The syntax in the files is important. Basically to add users you'll have to add new lines to the files (easy) with two or three fields edited, the others may remain as they are (days before password expiration, days after Epoch, ...) If you know the syntax it should be easy enough, and the syntax can be obtained from manpages for example (man /etc/passwd). Passwords are set after this, using passwd for example, but that's another thing. I'm not sure if some of the Big distributions handle users in a complex way today, they shouldn't, but then again init scripts are handled in a complex way often (except in Slackware). If everything is all right, you should be able to easily script something that alters the three files and adds the users. For gods sake, first test it with one and not 100 accounts, and better yet don't use the original files at first, but do it with some testfiles like ~/passwd, ~/shadow, ~/group to see the effects.

I too doubt if anyone is willing to write the script for you (I would, if I had time heh) but surely you'll get help if you ask. If you have a partially ready or started-out script, post it here if you like, you'll get comments and suggestions.
 
Old 05-31-2007, 05:31 PM   #5
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
Quote:
For gods sake, first test it with one and not 100 accounts, and better yet don't use the original files at first, but do it with some testfiles like ~/passwd, ~/shadow, ~/group to see the effects.
What he said.
 
Old 05-31-2007, 07:58 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Do you have the list of usernames/passwords in a file? If so, check whether you have the newusers command installed - the man page gives details on using it.
 
Old 06-07-2007, 05:00 AM   #7
b3ckham88
LQ Newbie
 
Registered: May 2007
Posts: 4

Original Poster
Rep: Reputation: 0
source of help i can get from

ar sorry guys i was busy with other project for the past few days thus unable to reply, anyway is there any sites you guys can intro me for me to learn more about adding this 1 to 100 users thing, because i also need to know how to set them into the correct groups and add password to each user, urgent help needed please guide me guys, would be very grateful about it.
 
Old 06-07-2007, 05:01 AM   #8
b3ckham88
LQ Newbie
 
Registered: May 2007
Posts: 4

Original Poster
Rep: Reputation: 0
i do have all the user in a single file, but i think is that i tried to run that more than once then the system tells me that the file already existed or something like that, but right now the problem is that i need to know more than that, i need to know how to set password for each user also, can anyone give me a better idea about it ?
 
Old 06-07-2007, 05:20 AM   #9
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
Slow down and re-read post #4 in this thread. You may be in a hurry, but you have some reading ahead of you.
 
  


Reply



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
How to create user account in Sendmail?? redhat_vishipel Linux - Networking 2 09-28-2006 02:50 PM
linux create user account deus1 Linux - General 2 06-04-2005 06:32 PM
Create a New Super user account blazted Linux - Newbie 6 02-13-2005 03:56 PM
how to create root-like user/account? rsumbeling Linux - General 6 11-23-2004 12:38 PM
cannot create new user account kpachopoulos Linux - Newbie 4 08-17-2004 07:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 03:02 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
Open Source Consulting | Domain Registration