Skip to content

Instantly share code, notes, and snippets.

@ChronoMonochrome
Last active May 25, 2023 16:18
Show Gist options
  • Save ChronoMonochrome/0812bb8ecf8c6f6554be6bb900e546fc to your computer and use it in GitHub Desktop.
Save ChronoMonochrome/0812bb8ecf8c6f6554be6bb900e546fc to your computer and use it in GitHub Desktop.
A quick reminder for myself how to expose a local machine using an intermediate server

Quick start

Forward port 22 on local machine as server:22222

ssh -R 22222:localhost:22 server_user@server -p PORT

Expose this port on the server to the world using socat *

socat TCP-LISTEN:22223,fork,bind=0.0.0.0 TCP:localhost:22222

Now you can connect to the local machine from outside of the local network

ssh local_user@server -p 22223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment