ssh
ssh is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP ports can also be forwarded over the secure channel.[1]
Documentation
- man 1 'ssh' [EN]
Configuration
Files
-
/
-
etc/
-
ssh/
- ssh_config, Example: 1
-
ssh/
-
etc/
Syntax
ssh [PARAMETER ...] [USER@]HOST [COMMAND]
Parameters
- -1
- Forces ssh to try protocol version 1 only.
- -2
- Forces ssh to try protocol version 2 only.
- -l USER
- Specifies the USER to log in as on the remote machine. This also may be specified on a per-host basis in the configuration file.
- -L [BIND_ADDRESS:]SRC_PORT:HOST:DST_PORT
- Specifies that the given SRC_PORT on the local (client) host is to be forwarded to the given HOST and DST_PORT on the remote side. This works by allocating a socket to listen to port on the local side, optionally bound to the specified BIND_ADDRESS. Whenever a connection is made to this SRC_PORT, the connection is forwarded over the secure channel, and a connection is made to HOST port DST_PORT from the remote machine. Port forwardings can also be specified in the configuration file.
- -N
- Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).
- -p PORT
- PORT to connect to on the remote host.
- -R [BIND_ADDRESS:]SRC_PORT:HOST:DST_PORT
- Specifies that the given SRC_PORT on the remote (server) host is to be forwarded to the given HOST and DST_PORT on the local side. This works by allocating a socket to listen to DST_PORT on the remote side, and whenever a connection is made to this SRC_PORT, the connection is forwarded over the secure channel, and a connection is made to host port DST_PORT from the local machine.
- -t
- Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
- -X
- Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file.
Examples
- Connect to the machine neon with the user melman
ssh 'melman@neon.raysoft.loc'
tar --create --bzip2 --file=- "${HOME}/office" "${HOME}/private" \
| ssh 'melman@neon.raysoft.loc' "cat >${HOME}/backup/$(date +%F).tar.bz2"
ssh 'melman@neon.raysoft.loc' "tar --create --bzip2 --file=- \
${HOME}/office ${HOME}/private" >"${HOME}/backup/$(date +%F).tar.bz2"
References
- ↑ man 1 'ssh'