Creation of a secure user for SSH login on Debian.

It is common to get used to using the user root after having created your server in the cloud and obtaining these credentials. Whether you created a droplet in Digital Ocean or any other cloud service company such as AWS. Even, it may be the case that you configure an RSA for the root user and access your server through SSH as we publish in Adding new SSH keys to Droplet in Digital Ocean.
However, accessing the system with the root user is not recommended. On the one hand, it is a user with broad permissions and can be as powerful as it is destructive, even by mistake. On the other hand, it seriously compromises security. Today, you will learn how to create an alternative user for accessing your cloud server via ssh.
Step 1 - Create your user
The first thing you must do is create the user in question. For this, you can use the adduser command. You must replace sammy with the name of the user you want to create and follow the steps given by the console.
adduser sammy
Step 2 - Add the user to the sudo group
The second step is to add the user in question to the sudo group. As you already know, the sudo group will allow you to execute a command by preceding the word sudo so that said command is executed with privileges. For this, you can use the following command.
usermod -aG sudo sammy
Step 3 - Update SSH keys
The last step is to update the authorized keys for ssh access. If you already accessed previously with root, it's just a matter of copying the ssh directory to your new user's directory.
cp -r ~/.ssh /home/sammy
chown -R sammy:sammy /home/sammy/.ssh
If not and you are just creating an RSA key, we recommend our article Adding new SSH keys to Droplet in Digital Ocean.