Centos common user su to root prompts error, centosroot

Source: Internet
Author: User

Centos common user su to root prompts error, centosroot
1. When a common user in CentOS7 executes SU, the following error is reported:

[test@ecs-1453 ~]$ su -Password: su: Authentication failure
Solution: If the root user can log on to the system normally, use the root user to log on to the system first, and then perform operations 1. log on to the root account;
2. Execute sudo-I
[root@ecs-1453 ~]# sudo -i
3. Run chmod + s/bin/su.
[root@ecs-1453 ~]# chmod +s /bin/su
4. Verification
[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.

 

2. When a common user in centos6 executes su, the following error is returned:
[test@ecs-19cb ~]$ su - rootPassword: su: incorrect password
Solution:

 

If the root user can log on to the system normally, use the root user to log on to the system first, and then perform operations 1. log on to the root account;
2. View/etc/pam. d/su configuration file, # auth required pam_wheel.so use_uid is enabled. If yes, the user (usermod-g? The User ID of the wheel user) can be su, or a Password error will be prompted.
[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. Check the file permission as follows:
[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. Verification
[test@ecs-19cb ~]$ su - rootPassword:?su: incorrect password[test@ecs-19cb ~]$ su - rootPassword:?[root@ecs-19cb ~]#

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.