Linux VPS/Dedicated Server Security
Linux offers many distro’s and by default the root account gets enabled during setup. This adds a serious issue for security and in CentOS we can fix this by adding an administrative account and disabling the “root”. So by doing so we can run any task with root permissions by running the command with sudo .
Disable root on CentOS VPS
The ArchLinux team provided a detailed documentation about this guide, but i am elaborating it for quick and easy to use commands that will get you started quickly. (Visit here for ArchLinux Documentation)
- Login to your CentOS VPS and switch to your root account by running
suand then enter your root account password.
- Enabling sudo. If you don’t like vim then you can always use gedit or “nano” , its upto you.
After this, enter
The lines starting with
# are comment lines and will be ignored. Just uncomment the following line:
# %wheel ALL=(ALL) ALL
by removing the
# at the beginning. This line means that anybody in the group
wheel can use
sudo to run anything from anywhere.
- Add an account to group wheel. For example, if the account you use to perform administrative task is
gpasswd -a johndoe wheel
Now you can sudo from user
- Disable root account. You can always disable the root account by running:
passwd -l root
These are the most basic and early steps whenever you buy a new VPS, so good luck with this! I will be posting more guides relating to this soon.