CentOS6.6 ordinary users to use the sudo command to borrow root user rights

Source: Internet
Author: User

A. Description

Ordinary user Hadoop use: TAR-XZVF ns2.35.tar.gz command to extract the file, the system prompts to find the file, unable to open the directory, and then thought to use the sudo command to borrow root user permissions: sudo tar-xzvf Ns2.35.tar.gz

Result Tip: Username is not in thesudoers file. This incident would be reported.

Two. Parsing

After the installation of the CentOS system is complete, the default normal user is unable to use the sudo command to borrow root permissions, you need to add that user's permission in the/etc/sudoers file.

Three . Steps

1. Login with Superuser in terminal

$SU-

Enter the root password

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

#vi/etc/sudoers

Add a row below root all= (all)

username all= (All) all

Note: The above username replaced by your own ordinary user's username.

1.VI /etc/sudoers into the command line mode, if you want to edit the file, enter I to insert the edit mode

2. After adding the above command, click the ESC button, then go to command line mode

3. Then enter : Wq means save and exit, enter Colon first, and then enter 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: The above username replaced by your own ordinary user's username.

Four . Results

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


CentOS6.6 ordinary users to use the sudo command to borrow root user rights

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.