themercee
5/6/2019 - 2:07 PM

ssh commands

ssh-keygen

Generate a ssh key

ssh-keygen -t rsa -b 4096 -C "test@example.com"

Command to start Socks Proxy

ssh -D 4444 -f -C -q -N rootuser@domainOrIP

-D: Tells SSH that we want a SOCKS tunnel on the specified port number (you can choose a number between 1025-65536)

-f: Forks the process to the background

-C: Compresses the data before sending it

-q: Uses quiet mode

-N: Tells SSH that no command will be sent once the tunnel is up

To set the proxy on a linux box:

export http_proxy=socks5://127.0.0.1:4444 https_proxy=socks5://127.0.0.1:4444

An example of port forwarding

ssh -L 9002:127.0.0.1:9001