Skip to content

Instantly share code, notes, and snippets.

@pfandie
Created August 25, 2020 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfandie/6812bc2ae6ba805c46fdf1de6962db37 to your computer and use it in GitHub Desktop.
Save pfandie/6812bc2ae6ba805c46fdf1de6962db37 to your computer and use it in GitHub Desktop.
.ssh/config file
ForwardAgent yes
AddKeysToAgent yes
IdentityFile ~/.ssh/MY_PRIVATE_KEY
ForwardX11 yes
ForwardX11Trusted yes
TCPKeepAlive yes
ServerAliveInterval 60
ServerAliveCountMax 2
############## EXTERNAL EXAMPLE (AWS) ##############
# for example the port 22 is blocked (some reasons)
# you can use the 'my-jump-host' to ssh throug e.g. 443
Host my-jump-host
HostName domain.of.my.jump-host.io # e.g. an AWS EC2
ProxyCommand nc -X connect -x proxy.domain.intern:8080 %h %p
Port 443
User MY_OTHER_USER
Host my-eg-aws-host
HostName 10.180.10.10
ProxyJump my-jump-host
User MY_OTHER_USER
Host default-ec2
HostName 127.0.0.1 # (public ip of ec2 instance)
User ubuntu
############## EXTERNAL EXAMPLE (AWS) ##############
############## PROD ##############
Host prod-machine
HostName domain.or-ip.of-prod-host.com
User MY_PROD_USER
############## PROD ##############
############## QA ##############
Host qa-machine
HostName domain.or-ip.of-qa-host.com
User MY_QA_USER
############## QA ##############
############## DEV ##############
Host dev-machine
HostName 127.0.0.1 # (some internal IP)
############## DEV ##############
# default settings, if no alias is used, or no other information is provided
Host *
User MY_DEFAULT_USER
Port 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment