SSH¶
Converting SSH2 Keys¶
From ssh2 to openssh
From OpenSSH to ssh2
SCP Speed UP¶
To increase speed on transfer you can force cipher to arcfour.
You can use same mechanism with rsync when you use ssh encapsulation.
NOTE: THis reduce your security though
SSH Tunnels¶
Forward Tunnel¶
It is used when you want to forward local port to remote port over SSH.
Reverse Tunnel¶
It is used when you want to forward Remote Port to Local Port.
Usually used to allow access other way around.
SSH Agent automation¶
Undefine existing value and define new value in session.
This also keep the value same since nothing is changing.
File: .screenrc
Each call of screen command will overwrite the existing symlink.
File: .bashrc
_ssh_auth_save() {
ln -sf "$SSH_AUTH_SOCK" "$HOME/.screen/ssh-auth-sock.$USERNAME"
}
alias screen='_ssh_auth_save ; screen'
Now add key to your session with "ssh-add".
That should do it.
Tips & Tricks¶
Show fingerprint of key¶
Important: You can use -v to print random ASCII Image
# Using -E can specify MD5 has which mostly require to compare
ssh-keygen -lf .ssh/OLD/id_rsa.pub.old
It will print for all public key in single file if there is multiple key in it.
Also, it is usefull in identifying MITM Attack by comparing against your known host.
Print fingerprint on login¶
You can enabled printing of server key by setting following variable.
Tip: you can setup on any of following file /etc/ssh/ssh_config OR .ssh/config
Run Command from file Remotely¶
Place all your command in xyz file. And run as follows
Comment on public key¶
You can control comment on public key during generation using following command.
Temporarily disable ssh key forwarding¶
This will disable key forwarding, while login with the key.