Skip to main content

SSH

SSH tunnel

Copy SSH public key to remote host

ssh-copy-id [<options>] <host>
OptionDescription
-i <id_rsa.pub>The public key file to be copy, default is ~/.ssh/id*.pub
-p <port>TCP port
"-o IdentityFile <id_rsa>"Use <id_rsa> key file to connect remote host

SSH agent

For sh / bash

eval $(ssh-agent -s)

For csh / fish

eval (ssh-agent -c)

Add SSH private key

ssh-add <private key path>

Troubleshoot

Unable to negotiate with XXX.XXX.XXX.XXX port XX: no matching host key type found. Their offer: ssh-rsa,ssh-dss

Method 1

/etc/ssh/ssh_config
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

Method 2

~/.ssh/config
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

Method 3

~/.ssh/config
Host { <host IP address / host name> | * }
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa