博客园  :: 首页  :: 管理

如图为 Amazon Linux 2 操作系统 ,其中看到一条配置如下图红线标记所示:

image

下是因为,配置了这条配置,就能有如下的效果

如果一个用户 user01 在 wheel 组,那么可以直接su root  / su - root  / 甚至 su  -  xxx 其他用户,不需要提供密码

然后笔者又看了一下手上一台 Red Hat Enterprise Linux release 8.x (Ootpa) 主机 的 这个文件如下:

[root@qq-5201351 ~]# cat /etc/pam.d/su
#%PAM-1.0
auth            required        pam_env.so
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
auth            substack        system-auth
auth            include         postlogin
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         include         postlogin
session         optional        pam_xauth.so
[root@qq-5201351 ~]# 

可以看到  auth            sufficient      pam_wheel.so trust use_uid  这一条是注释了的、然后笔者测试,在wheel组的用户su 到其他用户就是需要密码的

对于生产环境,强烈建议是注释或者删除这一条配置,防止在wheel组的用户 su 到 root 或者其他用户,进行提权和恶意操作

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/19027137