ssh to the server to set everything up
set up home directory
mkdir /home/USERNAME
chown USERNAME /home/USERNAME
chmod 755 /home/USERNAME
set up ssh directory
mkdir /home/USERNAME/.ssh
chown USERNAME /home/USERNAME/.ssh
chmod 700 /home/USERNAME/.ssh
set up authorized_keys file
touch /home/USERNAME/.ssh/authorized_keys
chown USERNAME /home/USERNAME/.ssh/authorized_keys
chmod 600 /home/USERNAME/.ssh/authorized_keys
return to local machine
exit
create a new ssh keypair if needed (you can press enter at every prompt)
ssh-keygen -t rsa -b 4096 -C "Dell ubuntu dev laptop"
ssh-add
copy public ssh key to server (in home directory)
scp ~/.ssh/id_rsa.pub [email protected]:/home/USERNAME/id_rsa.pub
ssh into server again
append your public key that was copied, to authorized_keys
cat id_rsa.pub >> /home/USERNAME/.ssh/authorized_keys
done, time to test
exit
(you should be logged in without being asked for password!)