Linux : Add user to sudo

Linux : Add user to sudo

When using Ubuntu Linux, I can run root command with adding sudo before command parameter. But, when I use Centos, I can not run sudo command. I get This error when try to running sudo command :

[toto@data]$ sudo toto

[sudo] password for toto: 
toto is not in the sudoers file.  This incident will be reported.

This is because toto is not sudoers group. We must add group toto to sudoers file.

We can Add user to sudo with edit /etc/sudoers file. Login as root and open this file. Example, I want to add user sudo with group toto, so I can add this line :

toto ALL=(ALL) ALL

Save this file and log off. So, try to use sudo command 🙂

Add a Comment

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

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.