Skip to main content
Skrip cengkerang untuk memudahkan tambah user

Katakan anda ingin menambah user di dalsam sesuatu machine, dan kerana jumlah pengguna yang ramai, dan anda ingin mudahkan kerja anda, apa kata cuba guna skrip yang saya tulis ni. Ada pelbagai cara, tapi yang ni works for me ! :-)

Ini isi userlist.txt

s0218495
s0234215
s0112914
s0138186
s0314940
s0211621
s0137852
s0135854
s0312774
s0223259
s0135673
s0220908
s0211216

dan seterusnya....

for i in `cat userlist.txt`;
do useradd -g 102 -d /export/home/$i -s /bin/sh -m $i;
done

siap!

:-)


cuba check /etc/passwd anda.

(cara ini saya gunakan di atas machine Sun, jadi by default untuk local user dia allocate pada /export/home )

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).