Skip to content

SSH

Generate a new SSH key pair

sh
ssh-keygen -t ed25519 -C "your_email@example.com"

or

sh
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Start the ssh-agent in the background

sh
eval "$(ssh-agent -s)"

Add your SSH private key to the ssh-agent

sh
ssh-add ~/.ssh/id_ed25519
sh
ssh-add ~/.ssh/id_rsa

SSH Tunnel

sh
ssh -L local_port:remote_host:remote_port user@ssh_server

Example:

sh
ssh -L 9090:localhost:8005 arthur@192.168.0.0

Will allow access to the remote service running on port 8005 of the remote host via localhost:9090 on your local machine.

Show the SHA256 fingerprint of an SSH key

sh
ssh-keygen -lf ~/.ssh/id_ed25519.pub
sh
  ssh-keygen -lf ~/.ssh/id_rsa.pub