According to CentOS in Parallel Desktop, when switching the root user, the password is correct, but the switch has been unsuccessful, and su: Authentication failure is displayed

1. Problems occur

My password is obviously entered correctly, but it keeps reporting the following error to me
Please add a picture description

2. Analyzing the problem

  • I suspected that my password was wrong, so I clicked Log Out, re-entered the password, and found it was correctPlease add a picture description
  • I confirmed that parallels is an ordinary user (UID 1000~65535 is an ordinary user, UID 0 is a super user)
    Please add a picture description
  • Then I thought next, maybe when the root password was set at that time, I set it differently from the normal user of parallels, so I thought of two solutions:
    • Reinstall centos again
    • Find a way to reset the root password
  • Of course, the above method is a bit troublesome, and I accidentally clicked on an article, that is, when Parallels Desktop installs centos, it does not activate the super user root by default, so it needs to be activated manually

3. Solve the problem

The default user name of centos downloaded on Parallels Desktop is parallels. Its password needs to be set. The software does not set it automatically. The password must be greater than 8 digits, and the su command cannot be performed, that is, it cannot be switched to the root user, and it will prompt su: Authentication failure.

This is because Parallels Desktop does not activate the root super user by default when installing centos, so manual activation is required.

Enter the following command in the terminal:

sudo passwd
[sudo] password for parallels:(输入当前parallels用户的密码)
Changing password for user root.
New password:(设置root的密码)
Retype new password:(再次确认root的密码)
passwd: all authentication tokens updated successfully.(表示设置成功)

After activating and setting the root password, you can use suthe command to switch to the root user.

Please add a picture description

Note: There is a difference between su and sudo. To switch users with su, you need to enter the password of the user you want to switch to, while sudo is to enter the password of the current user.


4. References

  1. Parallels desktop installs centos7 default password and root problem
  2. CentOS 7 User Rights Management
  3. Linux root (super user) user password forgotten, how to reset the password

Guess you like

Origin blog.csdn.net/e2788666/article/details/131154844