Passwordless login on PythonAnywhere from Mac

So you want to login by SSH to your PythonAnywhere installation without using a password from your Mac?

First login to your PythonAnywhere account like so:

$ ssh <username>@ssh.pythonanywhere.com

NB: <username> is your PythonAnyhwre username. Not your email address. The password is the same password you use to login to the web site.

When logged in, create a .ssh folder in your home-folder like so:

cd
mkdir .ssh

Now logout, and create and create a SSH public/private key pair on your Mac like so:

cd
cd .ssh
$ ssh-keygen -t rsa -f name-of-your-key

This generates:

name-of-your-key
name-of-your-key.pub

Now, from your Mac run this command to append your public key to authorized_keys on the remote PythonAnywhere host:

$ cat ~/.ssh/name-of-your-key.pub | ssh <username>@ssh.pythonanywhere.com 'cat >> .ssh/authorized_keys' 

Also create a config locally on your Mac in ~/.ssh/config:

Host PythonAnywhereName
    Hostname ssh.pythonanywhere.com
    Port 22
    User <username>
    IdentityFile ~/.ssh/name-of-your-key

Now you can login like so:

$ ssh PythonAnywhereName