ssh tweaks
local port forwarding
The command forwards the local port of the systemremote.system.com to the localhost of the machine from which we are trying to ssh into remote.system.com
remote port forwarding
When someone tries to access theremote.system.com's port 8000 the request will be forwarded to local system's port 8000. For this to work properly we might need to edit /etc/ssh/sshd_config on remote.system.com to allow
dynamic port forwarding
where- -D 1080 — dynamic port forwarding via 1080;
- -C — compress all data;
- -N — do not execute remote command or shell;
-
-f — run in background. Dynamic port forwarding sets up a connection that will forward traffic to a remote server, irrespective of the destination port. Effectively it turns the SSH client into a SOCKS5 proxy server. Some advantages of dynamic port forwarding are
-
protocol agnostic (can handle HTTP and many others)
- TCP and UDP
- DNS resolution (happens on the proxy server rather than the client).
Using dynamic port forwarding for various services
ssh jump host
Persistent configuration
It can be set on the client's ~/.ssh/config file