Centos 普通使用者su到root使用者提示錯誤,centosroot

來源:互聯網
上載者:User

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 ~]#

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.