2.2 Make an SSH Connection

In most cases, you can connect to your host and log in using your password without making any changes to the default settings. Use ssh to connect to the remote server. The syntax is:

ssh [options] [user@]hostname[#port] [remote_command [arguments] ...]

When no user is specified, the client connects using your current login name. When no port is specified, the client uses the default port (which is 22 unless this has been changed in the client configuration file).

When no command is specified, ssh creates a new session on the remote host. When a command is specified, the command is executed on the host and then ssh exits. When no user is specified, the current user name is used.

To open a terminal session to a remote server using defaults

  1. Use ssh to connect to the server. For example:

    ssh joe@myhost
  2. The first time you connect to a host, you see a prompt asking you to confirm the authenticity of the host. For example:

    Host key not found in hostkeys database.
    Key fingerprint:
    xesem-cyvic-puhef-penyl-dugid-kxpif-tizyh-behen-gymum-fozyb-cuxex
    You can get a public key's fingerprint by running
    % ssh-keygen -F publickey.pub
    on the keyfile.
    Are you sure you want to continue connecting (yes/no)?

    You can confirm the validity of the host key by contacting the system administrator for that host. (For the procedure administrators can use to get this information, see Display the Fingerprint of the Host Public Key.)

  3. Enter yes in response to the prompt to accept the connection to this host. This adds the host key to your known host key list (in ~/.ssh2/hostkeys). Hosts whose key you hold are trusted hosts, and you will not see the unknown host prompt in subsequent connections.

  4. Enter your password to complete the connection.

NOTE:To simplify initial connections and eliminate the risk created by allowing users to accept unknown keys, administrators can manually add the host key to a user-specific or global known hosts list. For details, see Add a Key to the Client Known Hosts List.