Skip to main content
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

Gue dengan S2 gue. Sronok banget!
Beijing and image manipulation addict Salam, Image manipulation with command line is fun and time consuming too. Given my Digikam plugins unable to work, I start to figure out many wonderful features of other tool which offer almost the same quality. However I was stucked with ImageMagick,with many tutorial on the net: Here and Here for i in *jpg ;do convert -font helvetica -fill white -pointsize 18 -draw 'text 10,50 "ACM-ICPC Beijing 2005"' $i $i;done The pix above shows a heater to heat up guest room during ACM-ICPC competition. (outside building's temperature is almost 4 celcious).