# HG changeset patch # User Oleksandr Gavenko # Date 1452365454 -7200 # Node ID c6dc48292ee82e718aaf7a9139d16a6cf2c71642 # Parent 78eb9d75c7207936c46432bb406fc3923a4af3f7 Coping and deleting public keys. diff -r 78eb9d75c720 -r c6dc48292ee8 ssh.rst --- a/ssh.rst Sat Jan 09 19:50:03 2016 +0200 +++ b/ssh.rst Sat Jan 09 20:50:54 2016 +0200 @@ -27,11 +27,24 @@ $ ssh-keygen -p -N "newphrase" -P "oldphrase" -f ~/.ssh/id_dsa # change passphrase of priv key +Coping and deleting public keys. +================================ + +To copy your public key to remote host (for automatic login by pubkey +authentication):: + $ ssh $user@$host cat ">>" "~/.ssh/authorized_keys" <~/.ssh/id_rsa.pub # public pub key on remote host $ ssh-copy-id $user@$host # alternative to previous command +To remove ``known_hosts`` key (usually need if you change server pubkey or +change server):: + + $ ssh-keygen -R hostname + $ ssh-keygen -R hostname -f ~/.ssh/known_hosts + + Shell login. ============ ::