graybull's Blog

Linux自动批量添加用户

shell script如下:

该script从文件usernames中读取用户名,然后创建用户,并设置密码为:用户名+suffix

 

#!/bin/bash

suffix=123

for name in `awk '{print $0}' ./usernames`
do
#	echo $name
       useradd -d /home/${name} -g develop -s /bin/bash ${name}
#       echo ${name}${suffix}
       echo ${name}${suffix} | passwd ${name} --stdin
done




Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee