Environment: OpenBSD 5.3
When OpenBSD is installed by default, a common user is created:Yapingxin.
When the common user executes the "sudo" command, the following message is displayed:
Yapingxin is not in the sudoers file. This incident will be reported.
How can common users execute the "sudo" command? You only need to log on as root, and then perform the next two steps. After these two steps are completed, they will take effect immediately:
1. edit/etc/group
VI/etc/group
As shown in, in this file, find"Wheel:"This line, you can see,"WheelThis is the format defined by this user group.,. Make sure that our userYapingxinAdd this user group if it is not in the user group.
Ii. edit/etc/sudoers
VI/etc/sudoers
As shown in:
If we only needYapingxinThis user can executeSudo, Find"# User Privilege Specification", ModeledRootAdd a rowYapingxinYou can:
# User Privilege specificationroot all = (all) setenv: allyapingxin all = (all) setenv: All
If we wantWheelAll group users can executeSudo, You only need to# % Wheel all = (all) setenv: All"The comment symbol before this line (#) Remove:
# Uncomment to allow people in group wheel to run all commands # And set environment variables. % wheel all = (all) setenv: All
if we want all users in the wheel group to execute sudo , you do not need to ask for the password when executing sudo , then we only need to set " # % wheel all = (all) nopasswd: setenv: all "# . However, in this way, we 'd better not leave our computer, or never forget log
off to prevent such high permissions from falling into the bad guys.