######用户自动建立脚本######
vim auto_useradd.sh
#!/bin/bash
USER_COUNT=`cat /etc/passwd | grep '^westos:' -c`
USER_NAME='westos'
if [ $USER_COUNT -ne 1 ]
then
useradd $USER_NAME
echo "123456" | passwd $USER_NAME --stdin ####stdin意为标准输入####
else
echo 'user exits'
fi
添加权限 chmod +x auto_useradd.sh
用户自动建立脚本
最新推荐文章于 2024-05-17 11:05:45 发布