#!/bin/bash
#
for NUM in {1..9}; do
  user=user$NUM
  useradd $user
#userdel $user
  echo 'test' | passwd --stdin $user
done

如果想再linux下面建立多个用户,且不想手动一个个的建立,就可以使用上面的脚本来建立!

for NUM in{1..9}; do 这句意思是从1到9之间选择一个数字,因为此脚本是用于建立连续的用户,user1,user2....user9。

useradd $user这句是增加连续的用户

echo 'test' | passwd --stdin $user 这句意思是为这连续的用户添加同一的密码为 test

如果想删除用户就可以使用userdel命令!

linux下面用脚本批量建立用户






如有错误,请多多指教!

转载于:https://blog.51cto.com/liumissyou/1284419

相关文章:

  • 2022-12-23
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2021-06-27
  • 2021-08-15
  • 2021-08-28
猜你喜欢
  • 2021-10-01
  • 2021-10-08
  • 2021-07-23
  • 2021-07-24
  • 2021-08-13
  • 2022-12-23
相关资源
相似解决方案