Centos 普通用户su到root用户提示错误,centosroot
Centos 普通用户su到root用户提示错误,centosroot
一、在CentOS7中普通用户执行SU时,报如下错误:
[test@ecs-1453 ~]$ su - Password: su: Authentication failure
解决方法:
如果root能够正常登陆,就先使用root用户登录系统,再执行操作
1、登陆root账户;
2、执行sudo -i
[root@ecs-1453 ~]# sudo -i
3、执行chmod +s /bin/su
[root@ecs-1453 ~]# chmod +s /bin/su
4、验证
[test@ecs-1453 ~]$ su - root Password: su: Authentication failure [test@ecs-1453 ~]$ su - root Password: Last login: Tue Feb 27 18:44:34 CST 2018 on pts/0 Last failed login: Tue Feb 27 18:45:42 CST 2018 on pts/1 There was 1 failed login attempt since the last successful login.
二、在centos6中普通用户执行su时,报错如下:
[test@ecs-19cb ~]$ su - root Password: su: incorrect password
解决方法:
如果root能够正常登陆,就先使用root用户登录系统,再执行操作
1、登陆root账户;
2、查看/etc/pam.d/su配置文件,#auth required pam_wheel.so use_uid 这句是否被启用,如果启用了,那么加入了wheel组的用户(usermod -g? wheel 用户id)才能su,否则就会提示密码错误。
[root@ecs-19cb ~]# vim /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 include system-auth account sufficient pam_succeed_if.so uid = 0 use_uid quiet account include system-auth password include system-auth session include system-auth session optional pam_xauth.so
3、查看文件权限,正确如下
[root@ecs-19cb ~]# ll -a /bin/su? -rwsr-xr-x. 1 root root 34904 May 11? 2016 /bin/su [root@ecs-19cb ~]# ll -a /usr/bin/passwd? -rwsr-xr-x. 1 root root 30768 Nov 24? 2015 /usr/bin/passwd
4、验证
[test@ecs-19cb ~]$ su - root Password:? su: incorrect password [test@ecs-19cb ~]$ su - root Password:? [root@ecs-19cb ~]#
评论暂时关闭