添加用戶到 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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM