Skip to content

Instantly share code, notes, and snippets.

@ekiara
Created May 31, 2023 05:16
Show Gist options
  • Save ekiara/14f40eb7917668566980c27404633861 to your computer and use it in GitHub Desktop.
Save ekiara/14f40eb7917668566980c27404633861 to your computer and use it in GitHub Desktop.
ssh-cheatsheet.md

ssh Cheatsheet

Keep a tunnel running from a home machine to a VPS that allows you to ssh into the home machine from the VPS

# From the home machine (to establish the tunnel)
ssh -v -R <local-port>:localhost:22 <vps-username>@<vps-hostname>

# On the vps machine (to log into the home machine)
ssh -p <local-port> localhost

Open a tunnel with ssh for use as a SOCKS4/SOCKS5 tunnel by your browser, and other tools connecting to the internet

# The ssh tunnel
ssh -D <local-port> <vps-username>@<vps-hostname>
ssh -D localhost:<local-port> <vps-username>@<vps-hostname>

# On the browser, or system config:
# Set the socks4/socks5 proxy port to localhost:<local-port>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment