CentOS sudoでrootになる為の設定 | Subaru's Husband

Subaru's Husband

python、linux、バイクなんかのネタを書きます。
一応security業界でご飯を食べてます。
備忘録がメインだと思うので、未来の自分が助かれば最高。

[root@localhost home]# nano /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
auth required pam_wheel.so use_uid ← この行の#を削除して保存する。

[root@localhost home]# usermod -G wheel hiroyuki  ← hiroyukiをwheelグループに追加

[root@localhost home]#visudo
## Allows people in group wheel to run all commands
#%wheel ALL=(ALL) ALL

%wheel ALL=(ALL) ALL  ← 有効にするとwheelグループに属しているユーザがsudoできる