27.5.1 Using ssh to Connect to Another System

The ssh command allows you to log in to a remote system, or to execute a command on a remote system:

$ ssh [options] [user@]host [command]

host is the name of the remote OpenSSH server to which you want to connect.

For example, to log in to host04 with the same user name as on the local system, enter:

$ ssh host04

The remote system prompts you for your password on that system.

To connect as a different user, specify the user name and @ symbol before the remote host name, for example:

$ ssh joe@host04

To execute a command on the remote system, specify the command as an argument, for example:

$ ssh joe@host04 ls ~/.ssh

ssh logs you in, executes the command, and then closes the connection.

For more information, see the ssh(1) manual page.