linux 普通用戶切換成root免密碼


 

[root@ok ~]# vim /etc/pam.d/su

下面是/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            include         system-auth
  8 account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
  9 account         include         system-auth
 10 password        include         system-auth
 11 session         include         system-auth
 12 session         optional        pam_xauth.so
將第4行的#號去掉,然后將登陸用戶加入 wheel組
[root@ok ok]# usermod -G wheel ok
[ok@ok ~]$ su 
[root@ok ok]#
su直接切換成root

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM