Saturday, February 3, 2007

Creating Multiple Accounts in one go

Have you ever come across a situation wherin you have to create multiple accounts with similar names in a certain numeric sequence.Well even if u have did you ever think of automating the entire process so that you run one script and all that you have to do is keep entering their passwords. So here we go simply follow the procedure below.

Step 1.) Write this code in one file and save it.
for i in `seq 1 50`;
do
useradd user$i
passwd user$i
done

Step2.) Using chmod 777 make it an executable.

Step3.) Run the script using ./scriptname

Once you have executed the script all you have to do is keep entering the passwords for the accounts.