Linux Tutorial – Sudoers

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.

About Deniz Parlak

Hi, i’m Security Data Scientist & Data Engineer at My Security Analytics. I have experienced Advance Python, Machine Learning and Big Data tools. Also i worked Oracle Database Administration, Migration and upgrade projects. For your questions [email protected]


  1. Вуксан Драгић

    Please use “visudo” instead of “vi /etc/sudoers”. Visudo will verify its validity before saving the changes to disk and direct text editing dont do that.

Leave a Reply

Your email address will not be published. Required fields are marked *