LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   SUSE / openSUSE (https://www.linuxquestions.org/questions/suse-opensuse-60/)
-   -   automating add user accounts (https://www.linuxquestions.org/questions/suse-opensuse-60/automating-add-user-accounts-449613/)

inkjetprint 05-29-2006 10:39 AM

automating add user accounts
 
help:
any idea how to create 1000 user accounts automatically using shell scripts?
thks

marozsas 05-29-2006 11:25 AM

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.

marozsas 05-29-2006 11:42 AM

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.


All times are GMT -5. The time now is 03:11 AM.