Luis A. Mateos
Secure Shell

SSH is a cryptographic network protocol used for an encrypted connection between a client and a server. OpenSSH client is the most widely used client.

The following requirements must be met to be able to login into a remote machine via SSH:

The basic syntax of the ssh command is as follows:

ssh [OPTIONS] [USER@]:HOST

To use the ssh command, open your Terminal and type ssh followed by the remote hostname:

ssh ssh.particlerobots.com

When you connect to a remote machine through SSH for the first time, you will see a message:

The authenticity of host 'ssh.particlerobots.com (192.168.151.111)' can't be established. ECDSA key fingerprint is SHA256:7IrDXyeQi7+SiWyEqt8dnb1oucITEpq/Oz0W/Idi4rA. Are you sure you want to continue connecting (yes/no/[fingerprint])?

Each host has a unique fingerprint that is stored in the ~/.ssh/known_hosts file.

Type yes to store the remote fingerprint, and you’ll be prompted to enter your password.

Warning: Permanently added 'ssh.particlerobots.com (192.168.151.111)' (ECDSA) to the list of known hosts.

Once you enter the password, you will be logged into the remote machine.

When the username is not given, the ssh command uses the current system login name.

To log in as a different user, specify the username and the host in the following format:

ssh username@hostname

By default, when no port is given, the SSH client will try to connect to the remote server on port 22.

You can change the default SSH port to add an extra layer of security to the server by reducing the risk of automated attacks. To connect on a non-default port, use the -p option to specify the port:

ssh -p 5522 username@hostname

If you are experiencing issues from authentication or connection, try the -v option to print debugging messages:

ssh -v username@hostname

You can try a higher of verbosity with -vv, -vvv.

For a complete list of options read the manual page by typing man ssh in your terminal.

Config File

In case you are connecting to multiple remote systems over SSH. It is better to use the OpenSSH client with configuration file ~/.ssh/config.

In this file, you can store different SSH options for each remote machine you want to connect.

A sample SSH config is shown below:

    Host dev
        HostName dev.particle.com
        User quark
        Port 1234
        

When you invoke the ssh client by typing

ssh dev

the command will read the ~/.ssh/config file and use the connection details specified for the dev host. In this example, ssh dev is equivalent to the following:

ssh -p 1234 mike@dev.particlerobots.com
TOP 
2021 Luis A. Mateos