ubuntu添加账户
2020-01-13 本文已影响0人
车到山前必有路2021
su - root
mkdir /home/username
useradd -d /home/username username
passwd username
chown username:username /home/username -R
usermod -s /bin/bash username
添加sudo 权限:
usermod -a -G sudo username
一键执行脚本
#/bin/sh
if [ -z "$1" ]; then
echo "input your username!!!"
exit -1
fi
mkdir "/home/$1"
useradd -d "/home/$1" "$1"
passwd "$1"
chown "$1":"$1" "/home/$1" -R
usermod -s /bin/bash "$1"
usermod -a -G sudo "$1"
echo "The end..."