CentOS6.6 common users use the sudo command to borrow the root user permission, centos6.6sudo
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.