張明泰
unread,Jan 5, 2008, 8:03:14 PM1/5/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lccnet9407
# 建立user的script
[root@server1 adm]# vi add.sh
#!/bin/bash
for NAME in $(cat ./userlist)
do
echo $NAME
n=$(echo $NAME | cut -d, -f1)
p=$(echo $NAME | cut -d, -f2)
# echo $n $n
# echo $p $p
useradd -g users -m $n
echo $p | passwd --stdin $n
echo "username: $n , password: $p"
done
# 使用者帳號及密碼列表
[root@server1 adm]# vi userlist
student1,linux
student2,linux
student3,linux
student4,linux
student5,linux
student6,linux
student7,linux
student8,linux
student9,linux
student10,linux
student11,linux
student12,linux
student13,linux
student14,linux
student15,linux
student16,linux
student17,linux
student18,linux
student19,linux
student20,linux
student21,linux
student22,linux
student23,linux
student24,linux
student25,linux
student26,linux
student27,linux
student28,linux
[root@server1 adm]# ./add.sh
student1,linux
Changing password for user student1.
passwd: all authentication tokens updated successfully.
username: student1 , password: linux
student2,linux
Changing password for user student2.
passwd: all authentication tokens updated successfully.
username: student2 , password: linux
student3,linux
Changing password for user student3.
passwd: all authentication tokens updated successfully.
username: student3 , password: linux
student4,linux
Changing password for user student4.
passwd: all authentication tokens updated successfully.
username: student4 , password: linux
student5,linux
Changing password for user student5.
passwd: all authentication tokens updated successfully.
username: student5 , password: linux
student6,linux
Changing password for user student6.
passwd: all authentication tokens updated successfully.
username: student6 , password: linux
student7,linux
Changing password for user student7.
passwd: all authentication tokens updated successfully.
username: student7 , password: linux
student8,linux
Changing password for user student8.
passwd: all authentication tokens updated successfully.
username: student8 , password: linux
student9,linux
Changing password for user student9.
passwd: all authentication tokens updated successfully.
username: student9 , password: linux
student10,linux
Changing password for user student10.
passwd: all authentication tokens updated successfully.
username: student10 , password: linux
student11,linux
Changing password for user student11.
passwd: all authentication tokens updated successfully.
username: student11 , password: linux
student12,linux
Changing password for user student12.
passwd: all authentication tokens updated successfully.
username: student12 , password: linux
student13,linux
Changing password for user student13.
passwd: all authentication tokens updated successfully.
username: student13 , password: linux
student14,linux
Changing password for user student14.
passwd: all authentication tokens updated successfully.
username: student14 , password: linux
student15,linux
Changing password for user student15.
passwd: all authentication tokens updated successfully.
username: student15 , password: linux
student16,linux
Changing password for user student16.
passwd: all authentication tokens updated successfully.
username: student16 , password: linux
student17,linux
Changing password for user student17.
passwd: all authentication tokens updated successfully.
username: student17 , password: linux
student18,linux
Changing password for user student18.
passwd: all authentication tokens updated successfully.
username: student18 , password: linux
student19,linux
Changing password for user student19.
passwd: all authentication tokens updated successfully.
username: student19 , password: linux
student20,linux
Changing password for user student20.
passwd: all authentication tokens updated successfully.
username: student20 , password: linux
student21,linux
Changing password for user student21.
passwd: all authentication tokens updated successfully.
username: student21 , password: linux
student22,linux
Changing password for user student22.
passwd: all authentication tokens updated successfully.
username: student22 , password: linux
student23,linux
Changing password for user student23.
passwd: all authentication tokens updated successfully.
username: student23 , password: linux
student24,linux
Changing password for user student24.
passwd: all authentication tokens updated successfully.
username: student24 , password: linux
student25,linux
Changing password for user student25.
passwd: all authentication tokens updated successfully.
username: student25 , password: linux
student26,linux
Changing password for user student26.
passwd: all authentication tokens updated successfully.
username: student26 , password: linux
student27,linux
Changing password for user student27.
passwd: all authentication tokens updated successfully.
username: student27 , password: linux
student28,linux
Changing password for user student28.
passwd: all authentication tokens updated successfully.
username: student28 , password: linux
就這樣簡單......