Forums

How do I ssh to postgres DB using a key, (password less)

I want to connect to my pythonanywhere postgres DB using autossh from another Ubuntu VM. In this case running Grafana. I can connect from the ubuntu20 cli using your instructions, RichardBH-1752.postgres.pythonanywhere-services.com:11752, but it asks for a password and I want it to auto reconnects when the ubuntu restarts.

How do I add a ssh key for the postgress part? Is this the same as the keys in .ssh for SFTP access to my account?

Richard.

Yes, that's right -- if you put a public key into the authorized_keys file in .ssh, then you'll be able to connect a Postgres SSH tunnel, just like you could SFTP, scp, or regular ssh.