You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Rocky Linux 8.6中sudo切换root后短时间重复操作触发PAM权限拒绝问题求助

Rocky Linux 8.6中sudo切换root后短时间重复操作触发PAM权限拒绝问题求助

大家好,我们在使用Rocky Linux 8.6时碰到了一个棘手的问题,想请教下各位可能是哪项PAM配置导致的:

  • 首次执行sudo su -,输入密码后能正常切换到root用户;执行exit退回原用户也完全符合预期。
  • 但如果紧接着再次执行sudo su -(包括尝试sudo -i -u root,两种操作表现完全一致),就会直接报错:
    sudo: PAM account management error: Permission denied
    
  • 必须等待5分钟,或者退出当前用户重新登录后,才能再次正常用sudo切换到root。

补充说明下:这个问题在我们常用的CentOS主机上从未出现过,我们的使用习惯就是先登录普通用户,再通过这种方式提权到root。另外我们没有在sudoers文件中设置任何timestamp相关配置,而且明确希望每次切换都需要验证密码。

我提取了报错时的审计日志片段,看起来和faillock有关,但印象里密码验证的有效期应该是15分钟,现在的情况明显不对:

type=SERVICE_START msg=audit(1695911994.060:721): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=user-runtime-dir@806425 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'UID="root" AUID="unset"

type=SYSCALL msg=audit(1695911994.087:722): arch=c000003e syscall=257 success=yes exit=7 a0=ffffff9c a1=563ce2ed1330 a2=2 a3=0 items=1 ppid=1 pid=4846 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="(systemd)" exe="/usr/lib/systemd/systemd" key="logins"ARCH=x86_64 SYSCALL=openat AUID="unset" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root"

type=CWD msg=audit(1695911994.087:722): cwd="/"

type=PATH msg=audit(1695911994.087:722): item=0 name="/var/run/faillock/mlevine" inode=105544 dev=00:17 mode=0100600 ouid=806425 ogid=0 rdev=00:00 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0OUID="mlevine" OGID="root"

type=PROCTITLE msg=audit(1695911994.087:722): proctitle="(systemd)"

type=USER_ACCT msg=audit(1695911994.090:723): pid=4846 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting grantors=? acct="mlevine" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'UID="root" AUID="unset"

之前在CentOS里从没遇到过这种情况,实在有点摸不着头绪。下面是当前/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

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

我的用户组信息如下:

uid=806425(mlevine) gid=200(unixusers) groups=200(unixusers),10(wheel),707(fndsysadmin),33004(aosysadmins),210039(dev_linux_syseng)

备注:内容来源于stack exchange,提问作者Michael Levine

火山引擎 最新活动