copy ssh private key code example Example 1: how to copy ssh key ssh-copy-id -i ~/.ssh/mykey user@host Example 2: copy ssh public key cat ~/.ssh/id_rsa.pub