1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > linux su 不能输密码错误 su - root正确输入密码但是登录不了系统 报错su: Permission denied...

linux su 不能输密码错误 su - root正确输入密码但是登录不了系统 报错su: Permission denied...

时间:2022-05-08 12:03:28

相关推荐

linux su 不能输密码错误 su - root正确输入密码但是登录不了系统 报错su: Permission denied...

su - root输入了正确的密码但是一直报错,密码肯定是输入对的。这主要是因为权限的问题导致的。

Linux里面有一个文件,/etc/pam.d/su文件。

[[emailprotected] ~]$ cat /etc/pam.d/su

#%PAM-1.0

authsufficientpam_rootok.so

# Uncomment the following line to implicitly trust users in the "wheel" group.

#authsufficientpam_wheel.so trust use_uid

# Uncomment the following line to require a user to be in the "wheel" group.

#authrequiredpam_wheel.so use_uid

authsubstacksystem-auth

authincludepostlogin

accountsufficientpam_succeed_if.so uid = 0 use_uid quiet

accountincludesystem-auth

passwordincludesystem-auth

sessionincludesystem-auth

sessionincludepostlogin

sessionoptionalpam_xauth.so

主要是看第5、6这两行。如果把第6行注释打开了,那么只有那些加入了wheel组的普通用户才可以使用su - root来切换到root用户,比如如下所示:

现在有两个用户,一个是chaofeng,一个是chaofan。这两个用户中,chaofeng是加入到了wheel组里面的,如下所示:

[[emailprotected] ~]# id chaofeng

uid=1000(chaofeng) gid=1000(chaofeng) groups=1000(chaofeng),10(wheel)

[[emailprotected] ~]# id chaofan

uid=1001(chaofan) gid=1001(chaofan) groups=1001(chaofan)

然后现在我处于chaofeng这个用户登录的终端里面,执行su - root

[[emailprotected] ~]# su - chaofeng

Last login: Thu Jul 2 11:40:15 CST on pts/1

[[emailprotected] ~]$ su - root

Password:

Last login: Thu Jul 2 11:40:21 CST on pts/1

Last failed login: Thu Jul 2 11:42:33 CST on pts/1

There were 3 failed login attempts since the last successful login.

[[emailprotected] ~]# # 看的出来我现在登录成功了

接着现在我处于chaofan这个用户登录的终端里面,再次执行su - root尝试

[[emailprotected] ~]# su - chaofan

Last login: Thu Jul 2 11:42:19 CST on pts/1

[[emailprotected] ~]$ su - root

Password:

su: Permission denied

[[emailprotected] ~]$

我可以保证输入的root用户的密码是没有错误的,但是一直报错“su: Permission denied”。

所以从这里可以看出来/etc/pam.d/su我们去掉的这一行的作用所在了。

原文:/FengGeBlog/p/13223920.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。