添加用户到 wheel 组
debian
1. useradd -m xyz
m 表示在 home 下创建相应的用户目录。
2. passwd xyz
3. usermod -a -G wheel xyz
如果出现错误提示,那么需要 usermod: group 'wheel' does not exist, 需要 addgroup wheel
参考: https://superuser.com/questions/716636/i-cant-add-a-user-to-the-wheel-group/716637
4. vi /etc/pam.d/su
auth required pam_wheel.so
5. vi /etc/login/refs
SU_WHEEL_ONLY yes
参考: https://blog.csdn.net/cbbbc/article/details/51712913
6. apt-get update
, apt install sudo
安装 sudo
chmod u+w /etc/sudoers
vi /etc/sudoers
chmod u-w /etc/sudoers
%wheel ALL=(ALL:ALL) ALL
参考: https://blog.csdn.net/xiaotengyi2012/article/details/7340822
7. 创建用户后,可能出现 tab 按键不能使用的问题。
vi /etc/passwd
,找到用户名对应的哪一行, 把 sh 改为 bash
参考: https://blog.csdn.net/rzhzhz/article/details/7573201
https://www.cnblogs.com/klobohyz/archive/2011/12/22/2297392.html
centos
useradd xyz
passwd xyz
usermod -aG wheel xyz
参考: https://phoenixnap.com/kb/how-to-create-add-sudo-user-centos
ubuntu
adduser -m xyz
ls /home
passwd xyz
usermod -aG sudo xyz
参考: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04