Yaky's

Set up a non-root user

If you just got access to a VPS or a remote server, it is probably set up with only the root user. For the sake of better security and separation of concerns, it is a good idea to set up a non-root user for regular access.


Add a new user with a home directory and a bash terminal:

useradd --create-home --shell /bin/bash me

Set the password for the new user:

passwd me

If needed, allow the new user to run commands as root:

usermod -aG sudo anton

Interestingly, my Debian machine did not have sudo installed, so I had to install it separately:

apt install sudo

Forbid root user from logging in:

$EDITOR /etc/ssh/sshd_config

Find, uncomment if necessary, and change the line to:

PermitRootLogin no

From now on, log in as the user:

ssh me@mydomain.org

If needed, you can switch from me to root user:

sudo su