SSH(oh) LOCAL SSH(oh) ssh - usage, configuration and tips SYNOPSIS ssh [OPTION] REMOTE_HOST [COMMAND] TOC COMMAND LINE - options - x forwarding TUNNEL - create - connect through vpn on ssh tunnel - commands CONFIGURATION - example - control master SSH KEYS TODO SEE ALSO COMMAND LINE options -f : fork -L : local forward -D : dynamic forward x forwarding - does not work on slackware ssh -X - trusted, works on debian/slackware ssh -Y TUNNEL create Example: This can be used to create a socks proxy for a browser. ssh -f -D $PORT $SERVER sleep 30000 - D bindaddres:port / port (assumes localhost) - sleep 30000 : keep the connection alive with sleep command connect through vpn on ssh tunnel Example: If a SQL Server is only accesible in a different network, a tunnel can be created to access the SQL server through a computer that is accessible from outside that network. commands ssh -f -L 127.0.0.1:$PORT:$TARGET_SERVER:$TARGET_PORT $SSH_SERVER_USR@$SSH_SERVER sleep 30000 ssh -f -L 127.0.0.1:1234:SQL_server:1433 user@ssh_server sleep 30000 NOTE: on Microsoft SQL Server Studio use 127.0.0.1,1234 CONFIGURATION To add configuration options for specific host: $HOME/.ssh/config Host hostname [SSH OPTION] example This will always use port 8686 to connect to hostname: Host hostname Port 8686 control master NOTE: The user needs to have write permissions in the directory where the socket will be created. Create a persistent connection when connecting to a remote machine. Eg.: ssh -f remote sleep 30 Host [HOST] ControlMaster auto ControlPersist yes ControlPath [PATH_TO_CONTROL_SOCKET]/%r@%h:%p Commands The socket can be controlled using -O: ssh -O [stop|exit|cancel|check|forward|proxy] HOST stop | stop accepting requests. exit | exit master. cancel | cancel forwardings. forward | request forwardings. proxy | connect to master in proxy mode. SSH KEYS ssh-keygen Copy the resulting pub contents to the corresponding Host. TODO - Review -L. - Add better examples. SEE ALSO - OpenBSD manpages: ssh(1) , ssh_config(8) , sshd_config(8) AUTHORS ohazot(oh) | about(oh) | ohazot.com: https://ohazot.com OpenBSD 7.7 linux| Created:2025-10-03|Updated:2025-10-19| SSH(oh)