set Up and enable “SUDO” on Linux Environments. [HowTo]

Posted by

Normally, when you install a new operating system you get root access to the entire host, you could enable, disable, manage, etc. services, permissions, processes, etc. but what happen if your user does not have sudo privileges ?

As Linux manage all the information, services, processes, as a “files”, to successfully enable the sudo feature you will need to open a SSH connection to the host and navigate to the following path to enable that feature:

[root@securitytweak sudoers.d]# pwd

There you will find some files named with the “usernames” associated with that host, if the folder is empty and there’s no exist any file with the username you want to configure, you just need to create the file with the specific username as a filename and edit the file with the following info. (if your user is already there, just edit the file)

To create the file with username “ebrenes

[root@ebsconnectors sudoers.d]# touch ebrenes
[root@ebsconnectors sudoers.d]# ls

To edit

You can use any of the editor that exist today, ( vi, nano, gedit etc). Please add the following information to the end of the file, (replace the word “USERNAME” with the right username you want to configure)

# echo “[USERNAME] ALL=(ALL) ALL”> etc/sudoers.d/[USERNAME]

After that, sometimes that specific file you have just created need a different permissions to successfully work in your environment, to do that apply the following command (permissions)

[root@ebsconnectors sudoers.d]# chmod 0440 /etc/sudoers.d/ebrenes
[root@ebsconnectors sudoers.d]# ll
total 0
-r–r—–. 1 root root 0 May 21 19:20 ebrenes

Finally, please restart your session and that is all !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s