执行命令
# 添加用户
sudo useradd test
# 设置密码
echo "test:1234" | sudo chpasswd
# Ubuntu 添加 sudo 权限
sudo usermod -aG sudo test
# Centos 添加 sudo 权限
sudo grep '^%wheel' /etc/sudoers
sudo usermod -aG wheel test
执行命令
# 添加用户
sudo useradd test
# 设置密码
echo "test:1234" | sudo chpasswd
# Ubuntu 添加 sudo 权限
sudo usermod -aG sudo test
# Centos 添加 sudo 权限
sudo grep '^%wheel' /etc/sudoers
sudo usermod -aG wheel test