Blog Unix

add admin rights to existing user in centos/linux

One of the important things to do in setting up a VPS or any Linux webserver is to NOT use the root user after the initial setup. The reason is obvious, root is so powerful. When connecting remotely to our server from a not-so-secure internet connection, a small mistake would mean your root password can be viewed by unscrupulous people. To work around it, we need to create a user that can act as administrators. For linux, particularly RedHat based Fedora and CentOS, it is called sudoers.

Sudoers (/etc/sudoers) allows delegation of roles and permissions for users or groups without sharing the root password. To add/del/edit the sudoers, connect as root and then run visudo.

[root]# visudo

Append the following

userid ALL=(ALL) ALL


kwatog ALL=(ALL) ALL

Once logged-in into the ssh, you can run the command below to gain root access.

[kwatog]# sudo -s