博文

目前显示的是标签为“linux创建用户”的博文

linux下创建/删除用户

#/bin/bash   del_user() { echo “请输入用户名:” read user echo “请确认是否删除(y/n)?” read isDel if [ $isDel = ‘y’ ]; then userdel -r $user echo -e “\t\t\t\t|——————————|” echo -e “\t\t\t\t|——- 用户 ‘$user’ 已删除 ——|” echo -e “\t\t\t\t|——————————|” fi }   add_user() { echo “请输入用户名:” read user useradd $user -d /work/$user passwd $user echo -e “\t\t\t\t|——————————|” echo -e “\t\t\t\t|——- 用户 “$user” 已创建 ——|” echo -e “\t\t\t\t|——————————|” }   menu() { while : do echo “1.添加用户” echo “2.删除用户” echo “0.退出” echo -e “\n请选择:” read...