_ _ ___ | |__ __ _ _______ | |_ / _ \| '_ \ / _` |_ / _ \| __| | (_) | | | | (_| |/ / (_) | |_ \___/|_| |_|\__,_/___\___/ \__|
ohazot | | docs | | about |
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
- 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
SSH KEYS
ssh-keygen
TODO
- Review -L.
- Add better examples.
SEE ALSO
OpenBSD manpages
files
<ssh.oh>