Skip to content
GradedJestRisk edited this page Apr 24, 2020 · 6 revisions

Generation (ssh-keygen)

Overview:

  • generate: ssh-keygen -t rsa -b 4096 -C “your_email@example.com”
  • get the public key (not private): cat ~/.ssh/id_rsa.pub
  • change passphrase: ssh-keygen -p

Agent (ssh-agent)

Overview:

  • start (if not working): eval `ssh-agent`
  • list all accessible keys (.ssh) : ssh-add -l
  • add a key : ssh-add
  • remove all keys: ssh-add -D

Connection

List:

  • connect to SERVER: ssh -i <KEY_FILENAME_WITHOUT_.PUB> <SERVER>
  • expose distant port DISTANT_PORT on localhost:LOCAL_PORT: ssh -i -L <LOCAL_PORT>:localhost:<DISTANT_PORT> <KEY_FILENAME_WITHOUT_.PUB> <SERVER>
Clone this wiki locally