Skip to content

SSH

Connect with ssh

Bash
ssh <user>@<ip> -P <port>

Exit an ssh session

Bash
exit

Tunneling

Socks 5 proxify

Bash
ssh -D<port> <user>@<ip>

Proxify connexion with an ssh tunnel

Bash
ssh -f <user>@<ip> -L <localPort>:<targetIP>:<distantPort> -N

Certificates

Generate a keys pair

Bash
# RSA
ssh-keygen -t rsa -b 2048
# ECDSA
ssh-keygen -t ecdsa -b 521
# ed25519 
ssh-keygen -t ed25519

# best practice
ssh-keygen -t ed25519 -f ~/.ssh/<NewKey>

Send the public key to a server

Bash
ssh-copy-id -i ~/.ssh/<NewKey> <user>@<host>

Sources