A quick how-to, mostly for my reference, but also because a Google search for “using ssh with certificates” brings up no useful resources.
To avoid having to type in your password every time you want to ssh to a server, you can set up the server to accept a certificate like this:
On your local machine, go to the command-line and type:
- cd ~/.ssh
- ssh-keygen -t rsa
- Choose no passphrase when asked and accept the default filename of id_rsa
- scp id_rsa.pub <user>@<yourhost>:.ssh/authorized_keys
- Provide your password when asked and that’s the last time you’ll have to do it!
If you get an error on the last step saying “scp: .ssh/authorized_keys: No such file or directory”, connect to your host and create the .ssh directory in your home directory.