The ssh command

OpenSSH remote login client 7 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.

Options in the examples

-L [bind_address:]port:host:hostport
Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port…
-p port
Port to connect to on the remote host. This can be specified on a per-host basis in the configuration file.
-R [bind_address:]port:local_socket
Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded to the local side.

Examples

ssh username@hostname
ssh username@192.168.1.100
ssh -p 2222 username@hostname

Custom port

ssh -L 8080:localhost:80 user@host
ssh -R 8080:localhost:80 user@host
ssh deploy@web01

Try to connect — read the error!

ssh deploy@web01 cat /srv/app/VERSION

Lessons that use ssh