Skip to content

Instantly share code, notes, and snippets.

@NanoDano
Created August 1, 2020 20:24
Show Gist options
  • Save NanoDano/9752a65c53626abaac5683e355b5fa75 to your computer and use it in GitHub Desktop.
Save NanoDano/9752a65c53626abaac5683e355b5fa75 to your computer and use it in GitHub Desktop.
SSH config example
# Example ~/.ssh/config
# Connect using ``ssh sandbox`` or ``scp sandbox:* .``
Host sandbox
HostName sandbox.local
User myusername
IdentityFile ~/.ssh/id_rsa
Port 22
ServerAliveInternal 30
ProxyJump jumphost.local
# If using local forward, do ssh -f -N host
# -f puts ssh in background
# -N makes it not execute a remote command
LocalForward 9906 127.0.0.1:3306
# Another local forward example.
# This one will take the service that sits on the remote host
# listening locally on port 3006 and makes it available
# via a local listener that listens on localhost:9999.
# E.g. Make a remote database that only listens locally available
# on your localhost port 9999
LocalForward 127.0.0.1:9999 127.0.0.1:3306
# Remote forward will make something available on the local
# machine/network available to the remote server.
# E.g. Making an internal git server available to the host you are
# connecting to that would not normally be able to reach the git
# server. This eample makes git available on the remote server's port 9999 while on
# the remote SSH server
# In the SSHD config set GatewayPorts to yes to allow public access
RemoteForward 9999 locally-accessible-address:22
# Set up a SOCKS proxy on 127.0.0.1:9999 that lets you pivot through the remote host(HostName)
# Then configure the local tool/browser to use a SOCKS proxy of localhost:9999
DynamicForward 127.0.0.1:9999
Host myotherhostalias
HostName example.com
# This will apply to all hosts.
Host *
IPQoS=throughput
# This fix errors like this in VMWare: packet_write_wait: Connection to x.x.x.x port 22: Broken pipe
# https://www.devdungeon.com/content/fix-broken-pipe-error-ssh-connection-fedoravmware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment