...
Create the user account.
Code Block sudo adduser username
Do not enter a password when prompted, as the SSH key will be the method of authentication.
If necessary, add the user to the sudo group.
Code Block sudo usermod -aG sudo username
Setup the user SSH folder.
Create the folder and set folder access privileges such that the user owns the folder.
Code Block sudo mkdir /home/username/.ssh sudo chmod 700 /home/username/.ssh sudo chown username:username /home/username/.ssh
Creating SSH key pair
The user being authenticated needs to generate the key pair. It is the responsibility of the user to secure and keep secret the secret key portion of the key pair.
...