wheelグループ以外suできないようにする

wheelグループ以外suできないようにする

dokuwiki.fl8.jp転載済

FreeBSDだと標準ですが、Linuxの場合どのユーザでもsuできるようになっているので、
下記を編集しておく。

/etc/pam.d/suのコメントを一行外すだけ

# Uncomment the following line to require a user to be in the "wheel" group.
# auth       required     /lib/security/$ISA/pam_wheel.so use_uid
                     ↓
# Uncomment the following line to require a user to be in the "wheel" group.
auth       required     /lib/security/$ISA/pam_wheel.so use_uid

これでwheelグループに所属していないユーザはsuできない。

CentOS5.2の/etc/pam.d/su

# Uncomment the following line to implicitly trust users in the "wheel" group.
#wheelグループに属していると、パスワード無しでsuできる
#auth           sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#wheelグループに属していると、パスワード有りでsuできる
#auth            required        pam_wheel.so use_uid