CentOS grants sudo permissions to common users

Source: Internet
Author: User

CentOS grants sudo permissions to common users

System Environment: centos 7.0

Citation: an account is assigned to everyone on the lab server, but sometimes common users need to use root permissions, such as installing some software. The following describes how to grant sudo Command Permissions to common users.

Prerequisites: sudo installation is complete.

Before configuration, you want to use the sudo command for normal users to temporarily grant root permissions and create a folder. Obviously, it fails because the user has no root permission.

The solution is as follows:

1. Open the sudoers file

Switch to the root user,cd root, RunvisudoCommand,visudoThe command is used to edit and modify/etc/sudoersConfiguration File

[root@master ~]# visudo

Open the sudoers file, as shown in.

2. Modify the suduers File

Locate the line marked with the red line, as shown in.

root  ALL=(ALL)    ALL

Add the sudo permission to liudiwei under the "root ALL = (ALL) ALL" line, and then add a row:

liudiwei ALL=(ALL)     ALL

Here, xulei is your current user name, that is, the user name of a common user.:wqSave and exit!

3. Check whether the test is successful.

Switch to normal user

su liudiweicd ~sudo mkdir test

Congratulations! Pass the verification code! : Run The sudo commandmkdir testThe test is created as the root user.

Supplement: if you do not want to verify the password when using sudo in the future, you can do the following in the sudoers file:timestamp_timeout=-1You only need to verify the password once and the system will automatically remember it later,runaspThe root password is required. If the root password is not added, the password of the Common Account is entered by default.

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.