- Create a new user: sudo useradd ‘username’
- Set the password: sudo passwd ‘username’
- Login to that user: su - ‘username’
- Create folder ~/.ssh: mkdir ~/.ssh
- chmod that folder to 700: chmod 700 ~/.ssh
- Generate public/private key: ssh-keygen (you don’t have to put a password, but should for better protection)
- cat the contents of id_rsa.pub to ~/.ssh/authorized_keys
- To allow the user to ssh in, open the sshd_config: vim /etc/ssh/sshd_config
- Append AllowUsers ‘username’
I got stuck a few times because I skipped steps #5.
A pretty nifty trick when you are ssh-ing in is to add the -v when you ssh, so you can see some messages as to why you ssh is unsuccessful (many times, I had the wrong path).
ssh -i /location/of/privatekey -v username@hostaddress