Warning: Undefined array key "cperpage" in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 230

Warning: Undefined variable $output in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 300

Warning: Undefined variable $fixed_tags in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 301

Warning: Undefined variable $isshowdots in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 302

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 305

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 308

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 311

Warning: Undefined variable $post in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Attempt to read property "ID" on null in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Undefined variable $post in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Attempt to read property "ID" on null in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Undefined variable $more_text_link in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320
Linux下批量创建删除账号 – 理想社会

Linux下批量创建删除账号

L

1、批量创建用户

cat adduser.sh 
#!/bin/bash
#
for username in $(more users.list)
do
if [ -n $username ]
then
useradd $username -g student -d /pub/home/$username
echo
echo $username"xyz" | passwd --stdin $username
chage -d 0 $username
echo $username "has been created!"
else
echo "The username is null!"
fi
done

2、批量删除用户

cat deluser.sh 
#!/bin/bash
#
for username in $(more users.list)
do
if [ -n $username ]
then
 userdel $username
 echo
 echo $username "has been deleted!"
else
 echo "The username is null!"
fi
done

3、创建users.list,将需要批量创建的有用户填入,一行一个。

About the author

Add comment

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

By now163

Your sidebar area is currently empty. Hurry up and add some widgets.