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