Setting correct permissions for the ./ssh folder on Ubuntu

Because I am often setting up servers for testing, and fiddling around with SSH keys, I often get confronted with the error 'Permissions 0664 for '/home/alex/.ssh/id_rsa' are too open'.

Screenshot showing the 'Permissions are too open error'
Screenshot showing the 'Permissions are too open error'

This error is, as suggested, caused by permissions being incorrect for the id_rsa private key file used for SSH. Fixing the permissions will cause SSH to then work correctly.

To save me from always struggling to find the permissions, I've decided to just post them here as a reference to myself.

chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
chmod 644 ~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
Commands to set permissions properly
linux, ssh