клиент удаленного входа OpenSSH (OpenSSH remote login client)
TCP FORWARDING
Forwarding of arbitrary TCP connections over a secure channel can
be specified either on the command line or in a configuration file.
One possible application of TCP forwarding is a secure connection
to a mail server; another is going through firewalls.
In the example below, we look at encrypting communication for an
IRC client, even though the IRC server it connects to does not
directly support encrypted communication. This works as follows:
the user connects to the remote host using ssh
, specifying the
ports to be used to forward the connection. After that it is
possible to start the program locally, and ssh
will encrypt and
forward the connection to the remote server.
The following example tunnels an IRC session from the client to an
IRC server at 'server.example.com', joining channel '#users',
nickname 'pinky', using the standard IRC port, 6667:
$ ssh -f -L 6667:localhost:6667 server.example.com sleep 10
$ irc -c '#users' pinky IRC/127.0.0.1
The -f
option backgrounds ssh
and the remote command 'sleep 10' is
specified to allow an amount of time (10 seconds, in the example)
to start the program which is going to use the tunnel. If no
connections are made within the time specified, ssh
will exit.