Skip to content

Eternal Center

  • System (系统)
  • Services (服务)
  • Databases (数据库)
  • Clusters (集群)
  • Big Data (大数据)
  • Cloud Computing (云计算)
  • Languages (语言)
  • Project (项目)
  • Writings (写作)
  • Eternity (永恒)
  • News (消息)
  • Chronicle (编年史)
  • Words (言)
Posted on March 5, 2021December 26, 2021 by Mingyu Zhu

[步骤] Linux su 命令白名单的设置

步骤一:设置只能属于某一个组的用户才能使用 su 命令
1.1 CentOS&RHEL 设置只能属于某一个组的用户才能使用 su 命令

# sed -i '/auth.*include.*common-auth/a     auth     required       pam_wheel.so use_uid' /etc/pam.d/su

(补充:这里以设置只能 wheel 才能使用 su 命令为例)

1.2 openSUSE&SUSE 设置只能属于某一个组的用户才能使用 su 命令

# sed -i '/auth.*include.*common-auth/a     auth     required       pam_wheel.so use_uid' /etc/pam.d/su
# sed -i '/auth.*include.*common-auth/a     auth     required       pam_wheel.so use_uid' /etc/pam.d/su-l

(补充:这里以设置只能 wheel 才能使用 su 命令为例)

步骤二:将需要使用 su 命令的用户添加到可以使用 su 命令的组

# usermod -a -G wheel eternalcenter

(补充:这里以给 eternalcenter 用户添加 wheel 附属所属组为例)

步骤三:验证 su 命令白名单
3.1 以其他普通用户的身份使用 su 命令切换到其他用户

(步骤略)

(补充:就算密码正确也会显示 su: Authentication failure)

3.2 以在白名单用户的身份使用 su 命令切换到其他用户

# su - eternalcenter
$ su - root
CategoriesChinese (中文), System (系统), System Login Security (系统登录安全), System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志), System Operation (系统操作), System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件), System Security (系统安全)

Post navigation

Previous PostPrevious [步骤] GRUB2 Bootloader 密码的设置 (CentOS Linux & RHEL 版)
Next PostNext 随笔 11

Aspiration (愿景):

Everyone can achieve self achievement and self happiness fairly

每个人都能公平地实现自我成就和自我幸福

Position (位置):

Running on Evolution Host and DigitalOcean

正在 Evolution Host 和 DigitalOcean 上运行

Logo (徽标):

Additional Information (其他信息):

About Manual Clone Contact Disclaimer Donation Friendly Links 关于 说明书 克隆 联系 免责申明 捐赠 友情链接

Standby IP Address (备用 IP 地址):

152.69.204.95  150.230.63.10  Please configure before use / 请先配置再使用

Search Outside Website (站外搜索):

Google Wikipedia Bing
Proudly powered by LNMP Proudly powered by WordPress