[Short Tip] Copy SSH-Identity

920839987_135ba34fffIf you regularly shh to a specific server, it is handy to copy the public part of your ssh key to the other server to avoid putting in the login password all the time. But instead of manually picking your public key, invoking scp manually to throw it to the server and calling echo/cat to attach it to

~/.ssh/authorized_keys

you can use one handy little command:

# ssh-copy-id liquidat@mymachine.de
liquidat@mymachine.de's password:
Now try logging into the machine, with "ssh 'liquidat@mymachine.de'", and check in:

~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

If you need to use a different port the command is a bit different than you might expect:

# ssh-copy-id "liquidat@mymachine.de  -p 1234"
Advertisements

3 thoughts on “[Short Tip] Copy SSH-Identity”

  1. Excellent tip, I’d always wondered why someone hadn’t come up with an easier method than the oft posted scp/chown procesess (or my own ugly .bash_aliases command).

    Many thanks.
    I should have looked in “apropos ssh” instead of the SEE ALSO section of “man ssh”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s