.Dd Created:2025-10-03|Updated:2025-10-19| .de ocsi \\$* , .. .de oxr .ocsi .Xr \\$* .. .de oit .It \\$* .. .de obdi .Bl -dash -compact .oit \\$* .. .de obdl .Bd -literal -compact \\$* .. .de onote .Bl -hang -compact .oit \\$* .El .. .de ocomm .Bl -diag -compact .oit \\$* .El .. .de opsy .Pp .Sy - \\$* .. .de obc .Bl -column \\$* .. .de obc2 .obc opt desc .. .de obc3 .obc option arguments description .. .Dt SSH oh .Os OpenBSD 7.7 linux| .Nm ssh .Nd usage, configuration and tips .Sh SYNOPSIS .Dl ssh [OPTION] REMOTE_HOST [COMMAND] .Sh TOC .Bl -column -offset indent "Sy It - Sx connect through vpn on ssh tunnel " .It Sx COMMAND LINE .It - Sx options .It - Sx x forwarding .It Sx TUNNEL .It - Sx create .It - Sx connect through vpn on ssh tunnel .It - Sx commands .It Sx CONFIGURATION .It - Sx example .It - Sx control master .It Sx SSH KEYS .It Sx TODO .It Sx SEE ALSO .El .Sh COMMAND LINE .Ss options .Bl -column ".Sy x forwarding " .It -f Ta : fork .It -L Ta : local forward .It -D Ta : dynamic forward .El .Ss x forwarding .obdi does not work on slackware .Dl ssh -X .oit trusted, works on debian/slackware .Dl ssh -Y .El .Sh TUNNEL .Ss create Example: This can be used to create a socks proxy for a browser. .Dl ssh -f -D $PORT $SERVER sleep 30000 .obdi D bindaddres:port / port (assumes localhost) .oit sleep 30000 : keep the connection alive with sleep command .El .Ss 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. .Ss commands .Dl ssh -f -L 127.0.0.1:$PORT:$TARGET_SERVER:$TARGET_PORT $SSH_SERVER_USR@$SSH_SERVER sleep 30000 .Dl ssh -f -L 127.0.0.1:1234:SQL_server:1433 user@ssh_server sleep 30000 .onote NOTE: on Microsoft SQL Server Studio use 127.0.0.1,1234 .Sh CONFIGURATION To add configuration options for specific host: .obdl $HOME/.ssh/config Host hostname [SSH OPTION] .Ed .Ss example This will always use port 8686 to connect to hostname: .obdl Host hostname Port 8686 .Ed .Ss control master .onote 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.: .Dl ssh -f remote sleep 30 .obdl Host [HOST] ControlMaster auto ControlPersist yes ControlPath [PATH_TO_CONTROL_SOCKET]/%r@%h:%p .Ed .Ss Commands The socket can be controlled using -O: .Li ssh -O [stop|exit|cancel|check|forward|proxy] HOST .obc2 .It stop Ta | stop accepting requests. .It exit Ta | exit master. .It cancel Ta | cancel forwardings. .It forward Ta | request forwardings. .It proxy Ta | connect to master in proxy mode. .El .Sh SSH KEYS .Dl ssh-keygen Copy the resulting pub contents to the corresponding Host. .Sh TODO .obdi Review -L. .oit Add better examples. .El .Sh SEE ALSO .opsy OpenBSD manpages: .oxr ssh 1 .oxr ssh_config 8 .Xr sshd_config 8 .El .Sh AUTHORS .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com