When connecting to your VPS, you should never login as root, in fact, root logins with password authentication should be disabled.
Instead you should mainly use a none-root account and elevate your access rights to root only when needed.
By default, you can not use sudo with a new user account, so before you can use it, you have to add the user account to the sudoers list.
As root (ironically, yes I know) open the sudoers list for editing by running this command.
1 |
visudo |
Note: If the ‘visudo’ command is not found, you may need to install sudo as this might be removed from some installations (or if you have run Minstall):
1 |
apt-get install sudo |
In this file, find this row:
1 |
root ALL=(ALL) ALL |
and add below
1 |
<username> ALL=(ALL) ALL |
where <username> is the username of the user that you would like to have the ability to elevate to root.
Save the file and exit. Test you newly changed settings by login as the new user and run “sudo”
3 comments for “Add Users to the Sudoers List”