首页 > 其他 > 详细

rhel7/centos7切换root用户无密码

时间:2015-05-22 19:23:20      阅读:1209      评论:0      收藏:0      [点我收藏+]

centos7 下,每当我们使用普通用户切换root用户时,都提示输入密码。但是在某些情况下(比如个人的电脑)就显得有些麻烦。

所以,无密码切换root就有必要了。

centos7/rhel7用户可按照对配置文件进行更改来实现:

配置文件名称:

/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

更改之后:

#%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.s

只需要注意标红的四行的就可理解。从中,也看出来这是系统本身就配置好的,至需要我们稍加修改就能实现。


本文出自 “7081517” 博客,请务必保留此出处http://7091517.blog.51cto.com/7081517/1653954

rhel7/centos7切换root用户无密码

原文:http://7091517.blog.51cto.com/7081517/1653954

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!