Examples of using OpenSSH for both CLI access, SFTP AND Tunneling. Avoid exposing vulnerable ports, and use encrypted tunneling instead.
GNU/LINUX Scenario: Tunnel from localhost:7777 that goes through my SSHD server to remotehost:21 (FTP):
ssh -L 7777:remotehost:21 [email protected]
GNU/LINUX Scenario: Tunnel from remotehost:7777 that goes to my local webserver:80 (WWW):
ssh -R 7777:localhost:80 [email protected]
WINDOWS Scenario: I want a tunnel from localhost:7777 that goes through my SSHD server to remotehost:3389 (RDP):
PuTTY > Connection > SSH > Tunnels > (Add source and destination:port) From Command Line: putty.exe -ssh <same command(s) as in GNU/Linux> -l user -pw password
NOTE: Remote tunneling may require
GatewayPorts yesin /etc/sshd_config
TIP: Add -fNT as a parameter if you only want to do background port forwarding without opening a shell.