« Funny boys | Home | How stupid can i be? »
Add many users on linuxsystem by script
By Robin | mei 31, 2007
Let us take 3 users as an example (niels, bart, robin), so create a file setusers.sh and put the following in it:
(use your favorite editor – nano – vi – pico or whatever you like) #nano setusers.sh
#!/bin/sh
####################
# first we create the users #
###################
adduser niels -m -G users,wheel -s /bin/bash
adduser bart -m -G users,wheel -s /bin/bash
adduser robin -m -G users,wheel -s /bin/bash
#####################
#now set passwords per user#
####################
echo “letnielsinpasswd” | passwd –stdin niels
echo “letbartinpasswd” | passwd –stdin bart
echo “letrobininpasswd” | passwd –stdin robin
(in nano you press CTRL-O to save your file)
When this is done be sure you are root at this point and run your bashscript as follow:
#sh setusers.sh
and you are done, users are added and passwords are set!
Topics: Linux | No Comments »
