CentOS6.6 common users use the sudo command to borrow root User Permissions

Source: Internet
Author: User

CentOS6.6 common users use the sudo command to borrow root User Permissions

I. Description

A common user uses the tar-xzvf ns2.35.tar.gz command to decompress the file. The system prompts that the file cannot be found and the directory cannot be opened. Therefore, he wants to use the sudo command to borrow the permissions of the root user: sudo tar-xzvf ns2.35.tar.gz

Result: username is not in the sudoers file. This incident will be reported.

Ii. Analysis

After the CentOS system is installed, normal users cannot use the sudo command to borrow the root permission by default. You need to add this permission to the/etc/sudoers file.

3. Steps

1. Log On As a super user on the terminal

$ Su-

Enter the root password

2. Edit the/etc/sudoers file and add the following command:

# Vi/etc/sudoers

Add a row under root ALL = (ALL) ALL

Username ALL = (ALL) ALL

Note: Replace the preceding username with your own username.

1. vi/etc/sudoers enters the command line mode. to edit the file, enter I to enter the insert and edit mode.

2. After the preceding commands are added, click the Esc button to enter the command line mode.

3. Enter: wqSave and exit. Enter a colon Before entering wq.

If you do not want to enter the password every time you use the sudo command, you can also add the following command:

Username ALL = (ALL) NOPASSWD: ALL

Note: Replace the preceding username with your own username.

Iv. Results

You can run the sudo tar-xzvf ns2.35.tar.gz command to decompress the file, that is, the root user's permissions can be used by common users.


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.