Skip to content

Instantly share code, notes, and snippets.

@hoangitk
Last active October 15, 2021 08:48
Show Gist options
  • Save hoangitk/a547fc1bd4c307833cc4441ec90fba8b to your computer and use it in GitHub Desktop.
Save hoangitk/a547fc1bd4c307833cc4441ec90fba8b to your computer and use it in GitHub Desktop.
[SSH Command] #ssh

SSH Command

  • Connect to server
> ssh <user>@<server>
  • Send remote command
> ssh <user>@<server> <command>
  • Keep alive
> ssh -o ServerAliveInterval=60 <user>@<server> 
  • Find a port is open
>  ssh <user>@<server> netstat -an | find "1433"
  • Forwarding

    • Local TCP forwarding: you can connect server service. From you: 127.0.0.1:
    > ssh -L <your-local-port>:127.0.0.1:<server-port> <user>@<server>
    • Remote TPC forwarding: remote server can connect to your service. From remote: 127.0.0.1:
    > ssh -R <server-port>:127.0.0.1:<your-local-port> <user>@<server>
  • SOCK5 Proxy

    • Create proxy
    > ssh -D <proxy-port> <user>@<server>
    • Configure Windows Internet Options
      • Internet Options > Connections > Advances > SOCK

Credits

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