Add User To Sudoers Centos RHEL 7:

All users doesn’t have permissions like root user, root user has the all permissions to install any packages or download any packages. To install or to download any packages or to do any activities in the centos/rhel/debian/ubuntu we need more permissions as like root user. In the following example i will show you how to add user to sudoers in centos or rhel or how to get permissions as like root user or make user as a sudo user in centos/rhel. Sudo user is nothing but is having permissions like root user. So the sudo user can download any packages and the sudo can install any packages.

Ex:

I have user called devops now i am trying to install httpd.

But when i tried to install httpd it is showing that you need to be root to perform this command.

That means the user devops has no permissions to install any packages. For that we need to make devops user as sudo user.

You can see that it is asking password of devops user. I entered password of devops user, But still the task is failed since the user devops is not the sudo user. For that we need to make devops user as sudo user. By giving sudo access to any user, user can download packages and the user can install that packages as like root user.

Adding User To Sudoers in Centos RHEL 7:

To give users to sudo permsiions we need to add that users to /etc/sudoers file.

To add any user to /etc/sudoers file we need permsions, We cant add directlry to /etc/sudoers file. Only root user can add users to /etc/sudoers file, So for that first logout from devops user and login as root user. After login as root user add below line in /etc/sudoers file.

as a root user  vi /etc/sudoers

syntax is:

<username>       ALL=(ALL)       ALL

Enter above line in /etc/sudoers file and save it. And now login as a devops user and try to install any package

Executing commands with sudo access:

You can see here, after entering install command with sudo, It will ask password of devops user. So we need to enter password of devops user. Now the httpd will install and we got full permissions as root user.So successfully we have added user to sudoers in centos/rhel.

 

 

  • Add User To Sudoers Centos
  • Add User To Sudoers rhel 7
  • sudo user centos
  • sudo user rhel 7
  • create sudo user in centos
  • create sudo user in rhel 7
  • add users to sudoers file