When you try to do a command that required root privilege like this
[phuongvu@localhost Desktop]$ sudo cat /etc/sudoers We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for phuongvu: phuongvu is not in the sudoers file. This incident will be reported.
A solution for this is add a current user in sudoers file. This file located in /etc/sudoers and you must use root privilege to edit this file.
Let do this:
Normally, sudoers file is read-only, therefore, we have to change access permission for it. Login as root user
[phuongvu@localhost Desktop]$ su Password: [root@localhost Desktop]# chmod 666 /etc/sudoers
Edit sudoers file
[root@localhost Desktop]# vi /etc/sudoers
Find this line and add new line like below
## Allow root to run any commands anywhere root ALL=(ALL) ALL phuongvu ALL=(ALL) ALL
Save and re-grant read-only property for it
[root@localhost Desktop]# chmod 440 /etc/sudoersDone. Now logout root account and use this command as normal user
[phuongvu@localhost Desktop]$ sudo cat /etc/sudoers
No comments:
Post a Comment