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 - rootPassword: su: Authentication failure[test@ecs-1453 ~]$ su - rootPassword: Last login: Tue Feb 27 18:44:34 CST 2018 on pts/0Last failed login: Tue Feb 27 18:45:42 CST 2018 on pts/1There was 1 failed login attempt since the last successful login.
二、在centos6中普通使用者執行su時,報錯如下:
[test@ecs-19cb ~]$ su - rootPassword: 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.0auth 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_uidauth include system-authaccount sufficient pam_succeed_if.so uid = 0 use_uid quietaccount include system-authpassword include system-authsession include system-authsession 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 - rootPassword:?su: incorrect password[test@ecs-19cb ~]$ su - rootPassword:?[root@ecs-19cb ~]#