Skip to content

Instantly share code, notes, and snippets.

@espinz
Created November 2, 2019 18:37
Show Gist options
  • Save espinz/d9c1e784d6391f49bcb34f9fa0386714 to your computer and use it in GitHub Desktop.
Save espinz/d9c1e784d6391f49bcb34f9fa0386714 to your computer and use it in GitHub Desktop.
ssh recipes

ssh

Recipes for the ssh command

local ssh config file

Use this file to setup remote host information

vi ~/.ssh/config

# type or copy this inside the file 

Host firstHop
    Hostname x.x.x.x
    User username
    IdentityFile ~/.ssh/firstHop-id_rsa
Host secondHop
    Hostname x.x.x.x
    ForwardX11 yes
    User username
    IdentityFile ~/.ssh/secondHop-id_rsa
    ProxyCommand ssh firstHop -W %h:%p
Host thirdHop
    Hostname 127.0.0.1
    User username
    IdentityFile ~/.ssh/thirdHop-id_rsa
    ProxyCommand ssh secondHop -W %h:%p
    Port 2222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment