Hi everyone, today i will show you what is sudoers file and what does it do?
When an authorized user creates a new user, the newly created user cannot perform certain operations such as read or write some secret file and installation new software on operating system. Must have sudo authority for these.
For example, i try to read /etc/shadow file (users password file with encrypted)
As you see, normal user can’t read that file because it is a very important file. After i tried to run with sudo but this time i was see oracle is not in the sudoers file.
It means, we need to add oracle to sudoers file . This file is located under /etc .
Loging root before edit that file.
su - root
vi /etc/sudoers
press the Shift+G combination , this will take you to the end of the file and press i for edit file.
Another problem 🙁
File is in read-only mode, needed to change permission. Exit file with ESC -> :q!
ls -l /etc/sudoers
chmod 640 /etc/sudoers
ls -l /etc/sudoers
Okay seems ready for writing. Open again ,
vi /etc/sudoers
press the Shift+G combination and press i for writing.
Add selected place with red field, you can change the user name or add other users.
Then, ESC -> :wq for exit .
Now, Let’s try again
sudo cat /etc/shadow
See, we can now run the command that we couldn’t run before adding it to sudoers.
See you next artical..
Do you want to learn Linux System Administration for Beginners, then read the following articles.
https://ittutorial.org/linux-administration-tutorial-for-beginners/