LinuxQuestions.org
Review your favorite Linux distribution.
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-29-2006, 10:39 AM   #1
inkjetprint
LQ Newbie
 
Registered: May 2006
Posts: 1

Rep: Reputation: 0
automating add user accounts


help:
any idea how to create 1000 user accounts automatically using shell scripts?
thks
 
Old 05-29-2006, 11:25 AM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
The command "/usr/sbin/useradd" is the interface to create/manage users accounts in linux.
You need a input file with user information (login name, password, full user name, ...) and iterate over this file. Something like that:
Code:
for line in $(cat /tmp/user.data); do
   user=$(echo $line | awk -F: '{print $1}')
   echo -n "Creating user $user..."
   password=$(echo $line | awk -F: '{print $2}')
   fullname=$(echo $line | awk -F: '{print $3}')
   useradd blah blah blah....
   echo " done."
done
You need to refinate this, add some checks, but you got the idea.

good luck

PS: Start with a small set of test users, John Doe One, John Doe Two, John Doe three in the input file. When your script is ready, you can start the real thing.

Last edited by marozsas; 05-29-2006 at 11:29 AM.
 
Old 05-29-2006, 11:42 AM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Another idea: Do you already have those users in a Windows Server ?
The command "net rpc user -l -U Administrator%xxxx -S ip_of_server" will return a list of all windows users in that server. You can use the "comment " field to pass additional information, like password, or FullName or both.
Then, use this as input to your script.
 
  


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
add more xp accounts to samba rulirahm Linux - Networking 3 07-20-2005 10:02 PM
User Accounts Verbal Kint Linux - Security 12 06-18-2005 12:11 AM
How can I add new user accounts? Ausar Linux - Newbie 2 08-09-2004 11:42 AM
add pop3 accounts plisken Linux - Software 0 02-25-2004 11:56 AM
User Accounts MrJoshua Linux - General 3 01-10-2003 08:30 AM

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

All times are GMT -5. The time now is 04:39 AM.

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