Today, in Linux, my classmates use my computer to help with things. Because I am not a root user, it is very troublesome to ask for authorization from time to time, however, the root password is not good for others, so I used the sudo passwd root command to change the root password, Because I installed the system as a new user, not a root user, and I am a newbie, I didn't quite understand the user and root, but thought I had changed the root password. I changed my current user password. As a result, I found that the password was incorrect and there were two passwords, so I learned something from Google.
The root user is different from the user who installs the system, unless the user name is root during installation.
During system use, you can use sudo passwd root to change the root password, provided that the user in use is allowed to use the sudo command, or can be used to change the password of other users, change root to another user name.
When using sudo commands, you do not need to enter the root password. You only need to enter the password of your account to have the root permission. Of course, the premise is that the user is allowed to use the sudo command.
In fact, "1. When a user executes sudo, the Linux system will look for the/etc/sudoers file and take the initiative to determine whether the user has the permission to execute the sudo command
2. if the user has the permission to execute sudo, ask the user to enter his/her password for confirmation. This is much better than the root password. Just like it.
3. If the password is entered correctly, run the shell command followed by sudo.
4. If the identity to be switched is the same as that of the su command, you do not need to enter a password.
Configure a non-root account so that it is allowed to use the sudo command as follows:
/Etc/sudoers file:
After the visodu command is used, the window opened is the same as that on the VI interface. To add the sudo command to the account, add the following content after root all = (all) All:
# User Account Logon host = (Changeable identity) commands that can be executed
Username all = (all) All
We have just introduced the user identity statement. Here is a special user group description -- wheel has the following content:
# Allows people in group wheel to run all commands
% Wheel
All = (all) All
# Same thing without a password
# The user does not need to enter a password when using the sudo command. The "all" command can be used as a shell command.
# % Wheel all = (all) nopasswd: All"
(This section references others)
In another command, the su command is used to switch users. By default, the su command is switched to the root account without parameters. Enter the root password.