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!

Vultr - another reliable alternative for SEA Virtual Private Server!

I have been using Vultr  as my recent VPS now, since it has just a nearby Data Center in Singapore (sadly, Malaysian VPS is always expensive.. so the best option is DC in Singapore - most of the time). It provides free trial credit for around USD5.. and +USD2 if you did a social media integration/sharing with Twitter. Try it now. Click Vultr