How to connect to Ubuntu from Mac via SSH Keys
The following instructions explains how to connect to an Ubuntu server through a mac terminal/console using ssh keys. It does not turn off the ability to login with a password (see step 7) and you cannot do this with root, see step 4.
1. Generate Mac keys. In terminal on your mac type:
ssh-keygen -t rsa -b 2048
2. Whilst still in terminal type:
3. Copy the text on the screen
4. SSH into your server and type
The Ubuntu username could be anything (except root), you cannot login using this method and root. If you need to learn how to create a new user see my other tutorial How to disable root on Ubuntu.
5. Paste into here then press
type “Y” and press enter.
6. You may not need to do this depending on your Ubunutu setup
sudo nano /etc/ssh/sshd_config
Make sure the following lines are as follows:
RSAAuthentication yes PubkeyAuthentication yes
7. Optional (Disable password login)
In the same file as step 6 if you want to turn off the ability to login with a password change the following lines:
PasswordAuthentication no UsePAM no