Skip to main content

SSH Forwarding Cheetsheet

66 words·1 min

Local port forwarding
#

ssh -L 8888:127.0.0.1:3306 somebox.example.com
  • Expose port 8888 on localhost and connect to 127.0.0.1 on the remote port 3306.
  • This allows you to connect to MySQL on port 8888 locally.
  • Instead of 127.0.0.1 you can point to any IP address on the network that is reachable.
ssh -NT -L 8888:127.0.0.1:3306 somebox.example.com
  • N - Do not execute remote command
  • T - Disable pseudo-tty allocation.