在一次處理su切換的問的時候出現一個問題, html
[cheng1@localhost ~]$ su cheng2 密碼: su: 鑑定故障 [cheng1@localhost ~]$
試過不少次, 也是這樣, 還找了不少文章, 那些哥們說的基本都是加sudo, 固然, 沒效果。bash
後來查着查着發現su有一個wheel組和/etc/pam.d/su, 呃...服務器
先看一下/etc/pam.d/su長什麼樣子session
[root@localhost home]# cat -n /etc/pam.d/su 1 #%PAM-1.0 2 auth sufficient pam_rootok.so 3 # Uncomment the following line to implicitly trust users in the "wheel" group. 4 auth sufficient pam_wheel.so trust use_uid 5 # Uncomment the following line to require a user to be in the "wheel" group. 6 #auth required pam_wheel.so use_uid 7 auth substack system-auth 8 auth include postlogin 9 account sufficient pam_succeed_if.so uid = 0 use_uid quiet 10 account include system-auth 11 password include system-auth 12 session include system-auth 13 session include postlogin 14 session optional pam_xauth.so [root@localhost home]#
第四行, 這傢伙搞的鬼post
下面引入Jan哥的一篇文章(非原創):Linux 中的 wheel 組和 staff 組ui
看了這個一切都明白了url
就是服務器限制了su使用權限, 沒辦法, 也不能直接取消這個配置, 那麼就直接把須要su的帳號扔進wheel組裏面htm
[root@localhost home]# usermod -G wheel cheng1 [root@localhost home]#
是G不是g, G是追加一個組, 而g是直接修改組, 區別很大blog
而後就一步達成了ci
[cheng1@localhost ~]$ su cheng2 [cheng2@localhost cheng1]$
區別出來了
[root@localhost home]# id cheng1 && id cheng2 uid=1002(cheng1) gid=1002(cheng1) 組=1002(cheng1),10(wheel) uid=1003(cheng2) gid=1003(cheng2) 組=1003(cheng2)