Command to send public key to remote host

user482594 picture user482594 · Aug 9, 2011 · Viewed 36.3k times · Source

I remember there is a command to send public key to the remote host that I want. I want to use that feature to send one of my public keys to the other host. How can I do that?

Answer

cdhowie picture cdhowie · Aug 9, 2011

You are looking for ssh-copy-id. All this command does is create .ssh and .ssh/authorized_keys and set their permissions appropriately if they don't exist. Then it appends your public key to the end of .ssh/authorized_keys.