su-root正确输⼊密码但是登录不了系统,报错su:
Permissiondenied
su - root输⼊了正确的密码但是⼀直报错,密码肯定是输⼊对的。这主要是因为权限的问题导致的。
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这两⾏。如果把第6⾏注释打开了,那么只有那些加⼊了wheel组的普通⽤户才可以使⽤su - root来切换到root⽤户,⽐如如下所⽰:
现在有两个⽤户,⼀个是chaofeng,⼀个是chaofan。这两个⽤户中,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我们去掉的这⼀⾏的作⽤所在了。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论