SSH

Utilities

scp — OpenSSH secure file copy

use scp on path with empty spaces:

scp 'user@host:/Path/"Some Filename With Spaces"' [destination]

ssh-add

ssh-add — adds private key identities to the OpenSSH authentication agent

ssh-add ~/mysshkey
ssh-add -L

ssh-keyscan — gather SSH public keys from servers

ssh-keyscan -H myhost.org,myhost2.org >> ~/.ssh/known_hosts

ssh-copy-id — use locally available keys to authorise logins on a remote machine

ssh-copy-id -i ~/.ssh/mykey user@host

SSH agent

ssh-agent — OpenSSH authentication agent

SSH agent forwarding

Lets the remote server use your local keys. Good for remote deployment when all remote servers are set with your public keys, but you do not want to have the private one leave your computer.

-A‘ Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a configuration file.

SSH key pair

The book Practical Cryptography With Go suggests that ED25519 keys are more secure and performant than RSA keys.

As OpenSSH 6.5 introduced ED25519 SSH keys in 2014, they should be available on any current operating system.

You can create and configure an ED25519 key with the following command:

ssh-keygen -t ed25519 -C "<comment>"

Remove shit

ssh-keygen -f ~/.ssh/known_hosts -R "192.168.53.130"

remove line 121 in known_hosts (-i = inplace)

sed -i '121d' ~/.ssh/known_hosts

oldies

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-dss -c aes128-cbc admin@192.168.188.75