OpenBSD tips: Enable 'sudo' command for a specific user

Source: Internet
Author: User

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.

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.