SSHd is one of the most versatile applications I use in my day. Whether I’m looking for a quick commandline to a remote machine or tunneling traffic from a public network, SSH or Putty are almost always open in some fashion on my systems.
To facilitate easier logins and make use of scripts such as my BASH backup script without passwords, I generate SSH keys and copy them to the remote system. This can be done in two commands, however with the copy command, I often forget the format for non-standard ports.
To generate the key on the client system:
ssh-keygen -t rsa
With default values, this will place id_rsa and id_rsa.pub in your ~/.ssh/ folder.
To copy your new key to the remote system:
ssh-copy-id '-p 12345 firstname.lastname@example.org'
That’s it! You should now be able to login just by typing:
ssh email@example.com -p 12345