Copy SSH Keys to Server

Here we describe how to copy over your public ssh keys to a server on Linux and MacOS.

There is a good clear article over at [[DigitalOcean] on how to copy your ssh keys to a server:

- Add keys to existing server - digitalocean.com - Explanation of shell commands - stackexchange

It might also be useful to read up about using a proxy command: - Simple explanation of using ssh proxy - cyberciti.biz

From a Mac to a Linux Server

In order to login to your Linux Server over SSH from a Mac you must first copy over your Public key and Mac OSX does not come with the ssh-copy-id command so you need to either:

  1. Copy the public key from Mac OSX to the Linux server manually - linuxmoz.com
  2. Install ssh-copy-id with brew

The simplest thing to do is to follow the instructions over on ssh-copy-id.

# Server-to-server SSH keys

Note on Security

Using password-less ssh sessions with public/private keys isn't recommended for daily use from user consoles (ie, a typical desktop computer). If your workstation is accessed without authorization, the keys to the kingdom belong to the crook.

If you want the convenience of password-less ssh sessions, you should use Kerberos instead. At least with Kerberos authentication, someone, at some point, needs to provide Kerberos credentials prior the expiration period. Moreover, there are no files on the workstation to steal with Kerberos - stanford.edu

Most admins use pub/pri keys for mundane things, like automated rsyncing between two servers. There are, like everything else unix, many ways to skin a cat; but if done properly, you can do this in a reasonably secure way, with layers of security corresponding to your level of paranoia.

# See also