Article directory
sudo problem
sudo: Permission prompt command. When using the sudo command, the authority of ordinary users will be elevated to root authority.
However, when creating a new user on the command line, this user cannot use the sudo command to elevate the authority of a command.
This user is not in sudoers file, it means that the user is not trusted, and when the password is elevated, it still enters the user's password, then every newly created user can execute with root authority, so isn't root It's pointless! In fact, it is not, because generally newly created users use sudo to enter their own passwords to escalate their privileges and cannot use the corresponding commands, because the system does not trust you for this user, even if you use my identity to execute it, it will not work. For example, when I went to my high school, I met a teacher and wanted to enter the school, but the security guard at the gate didn't know me, so he wouldn't let me enter the school. I had to greet the security guard before I could enter the school! If I often want to go to this school, then I can ask the teacher to tell the person in the security room that this person will let me go directly when he comes, which is equivalent to adding me to the security white list.
So how to add it to the trust white list (sudoers file), my own user is not allowed. The
owner and group of this configuration file are both root, and the permissions of other people are nothing.
This user: I don’t believe me It needs to be changed. Open it with vim, and you will find that you have no permission to modify it.
To change this configuration file, you can only change it under the root user.
Open this configuration file under the root user,
find here, and then add the user you want to add
because root only has read permission, so I want to force write.
After adding, the user zhangsan can use the sudo command to escalate the authority.
When the user in the configuration file is removed, he can no longer use sudo.