Uh,uh! Adding new user

Salam,
Any better solution, please share. This what I have/tried did so far;

1-Make a longfile name with matric numbers;
e.g
01234
02345
03455

save in user.txt

2-As there are a lot of users with different matrix number, the idea is
to keep username unique and easy to recognize as possible;

use sed (unix Stream Editor);

sed -i 's@^\([0-9]\)@coursename\1@g' user.txt


this will put the course name as the prefiks of the matrics number
inserted in the longlist(so you save time to insert same thing for many
times).

(replace coursename with the name that relates; spl or java,AI for example).

3- run this script, say here adduser.sh

#!/bin/sh
#adding user
for i in `cat userlist.txt`;
do useradd $i -s /bin/bash -d /home/$i -m ;
echo $i;
passwd $i;
done


This is the fastest and the accurate that I can do, you all might have
better solution. Thanks!
(Adding new users on 2 different machine plus 2 new password enquiries
means we need better way of adding new users).
p/s: still figuring out the best way to assign password in the loop here

Comments

Popular posts from this blog

Panduan Bas Ekspres Kuala Lumpur (TBS) - Skudai

Cara Renew Passport Pembantu Rumah di Kedutaan Indonesia 2015