One recommended way to manage virtual private server (VPS) or a dedicated linux server is not using the root account as the main access for SSH login. This is because usually the hackers will try to brute force your root password and potentially get access to your server. Instead of using the default root account, you can create a new account and assign root privileges to it and issue the sudo command line to root from it. Please make sure that the normal user account given root privileges accounts work properly before you disable the default root login access. The following command has been tested works on CentOS 6, CentOS 7, RHEL 6 and RHEL 7 VPS.
[[email protected] ~]# useradd skytech [[email protected] ~]# passwd skytech Changing password for user skytech. New password: Retype new password: passwd: all authentication tokens updated successfully.
[[email protected] ~]# visudo
Add the following code at the bottom of the file and save the file with the command :wq :
## Allow skytech user to run any commands anywhere skytech ALL=(ALL) ALL
This will grant a root privileges to the normal user skytech.