.Dd Created:$Mdocdate$ .Dt ohazot_ssh .Tg back_to_top .Bd -literal -compact _ _ ___ | |__ __ _ _______ | |_ / _ \\| '_ \\ / _` |_ / _ \\| __| | (_) | | | | (_| |/ / (_) | |_ \\___/|_| |_|\\__,_/___\\___/ \\__| .Ed .Tg menu .Bl -column ".Sy ohazot " ".Sy ohazot " ".Sy ohazot " .It Xr ohazot oh Ta | .Xr docs oh Ta | .Xr about oh Ta .El .Dd Created:2025-10-03|Updated:2025-10-06 .Dt ohazot_ssh .Os OpenBSD linux .Nm ssh .Nd usage, configuration and tips .Sh SYNOPSIS .Sx back_to_top .Dl ssh [OPTION] REMOTE_HOST [COMMAND] .Sh TOC .Sx back_to_top .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 .Sx back_to_top .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 .Bl -dash -compact .It does not work on slackware .Dl ssh -X .It trusted, works on debian/slackware .Dl ssh -Y .El .Sh TUNNEL .Sx back_to_top .Ss create Example: This can be used to create a socks proxy for a browser. .Bd -literal -compact ssh -f -D $PORT $SERVER sleep 30000 .Ed .Bl -compact .It D bindaddres:port / port (assumes localhost) .It 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 .Bd -literal -compact ssh -f -L 127.0.0.1:$PORT:$TARGET_SERVER:$TARGET_PORT $SSH_SERVER_USR@$SSH_SERVER sleep 30000 .Ed .Bd -literal -compact ssh -f -L 127.0.0.1:1234:SQL_server:1433 user@ssh_server sleep 30000 .Ed .Bl -hang -compact .It NOTE: on Microsoft SQL Server Studio use 127.0.0.1,1234 .El .Sh CONFIGURATION .Sx back_to_top To add configuration options for specific host: .Bd -literal -compact $HOME/.ssh/config Host hostname [SSH OPTION] .Ed .Ss example This will always use port 8686 to connect to hostname: .Bd -literal -compact Host hostname Port 8686 .Ed .Ss control master .Bl -hang -compact .It The user needs to have write permissions in the directory where the socket will be created. .El Create a persistent connection when connecting to a remote machine. Eg.: .Dl ssh -f remote sleep 30 .Bd -literal -compact Host [HOST] ControlMaster auto ControlPersist yes ControlPath [PATH_TO_CONTROL_SOCKET]/%r@%h:%p .Ed .Sh SSH KEYS .Sx back_to_top .Bd -literal -compact ssh-keygen .Ed Copy the resulting pub contents to the corresponding Host. .Sh TODO .Sx back_to_top .Bl -bullet -compact .It Review -L. .It Add better examples. .El .Sh SEE ALSO .Sx back_to_top .Ss OpenBSD manpages .Xr ssh 1 , .Xr ssh_config 8 , .Xr sshd_config 8 .Ss files .In ssh.oh .Sh AUTHORS .Sx back_to_top .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com