su-rootパスワードを正しく入力したがシステムにログインできず、su:Permission denied

1934 ワード

su-rootは正しいパスワードを入力したが、ずっと間違っていて、パスワードは入力が正しいに違いない.これは主に権限の問題によるものです.Linuxにはファイルがあります./etc/pam.d/suファイル.
[chaofan@master ~]$ cat /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

主に5、6の2行目を見ます.6行目のコメントを開くと、su-rootを使用してrootユーザーに切り替えることができます.たとえば、現在2人のユーザーがいます.1人はchaofengで、1人はchaofanです.この2人のユーザーのうちchaofengはwheelグループに加入しており、以下のようになっています.
[root@master ~]# id chaofeng
uid=1000(chaofeng) gid=1000(chaofeng) groups=1000(chaofeng),10(wheel)
[root@master ~]# id chaofan
uid=1001(chaofan) gid=1001(chaofan) groups=1001(chaofan)

そして今私はchaofengというユーザーがログインしている端末の中にいて、su-rootを実行しています.
[root@master ~]# su - chaofeng
Last login: Thu Jul  2 11:40:15 CST 2020 on pts/1
[chaofeng@master ~]$ su - root
Password: 
Last login: Thu Jul  2 11:40:21 CST 2020 on pts/1
Last failed login: Thu Jul  2 11:42:33 CST 2020 on pts/1
There were 3 failed login attempts since the last successful login.
[root@master ~]#                                                       #             

そして今私はchaofanというユーザーがログインしている端末の中にいて、再びsu-rootの試みを実行します.
[root@master ~]# su - chaofan
Last login: Thu Jul  2 11:42:19 CST 2020 on pts/1
[chaofan@master ~]$ su - root
Password: 
su: Permission denied
[chaofan@master ~]$ 

入力したrootユーザーのパスワードに間違いがないことを保証できますが、「su:Permission denied」とずっと間違っています.ここから/etc/pamがわかりますd/su私たちが取り除いたこの行の役割はあります.