

Log into your remote server as a root user or with an account with sudo privileges
Create Home and .ssh Directory
mkdir -p /home/yournewuser/.ssh
Create Authorized Keys File
touch /home/yournewuser/.ssh/authorized_keys
Create User and Set Home Directory for New User
useradd -d /home/yournewuser yournewuser
Add User to sudo Group for sudo privileges
usermod -aG sudo yournewuser
Set Password for User – Optional
This will allow access into the server without the need for your private key in as much as PasswordAuthentication is enabled in /etc/ssh/sshd_config.
passwd yournewuser
Disable Password Authentication on Your Server – Optional
This is optional but should only be done to improve security
nano /etc/ssh/sshd_config
This will disable your ability to log in via SSH using usernames and passwords. Inside the file, search for the line containing PasswordAuthentication. This may be commented out. Uncomment the line and set the value to “no”.
/etc/ssh/sshd_config
.
.
.
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
.
.
.
Press CTRL X to save and close the file then Y to confirm, followed by ENTER to exit the editor
Restart SSH Server
systemctl restart ssh
Set Permissions
chown -R yournewuser:yournewuser /home/yournewuser/
chown root:root /home/yournewuser
chmod 700 /home/yournewuser/.ssh
chmod 644 /home/yournewuser/.ssh/authorized_keys
Generate SSH Key
Log into the new user to create SSH (Priv/Pub Keys)
su yournewuser
ssh-keygen -a 1000 -b 4096 -C "" -E sha256 -o -t rsa
Specify the location of ssh files as requested
/home/yournewuser/.ssh/authorized_keys
Final Steps – Optional
Covert generated private key to ppk for use with Putty
apt-get install putty-tools
puttygen authorized_keys -o authorized_keys.ppk