SSH (Secure Shell) is a network protocol that allows users to connect securely to a remote server through an encrypted connection. This means that you can send and receive data securely without worrying about interception or data theft by third parties.

The most common use of SSH is connecting to a remote server to perform administrative or maintenance tasks. For example, if you have a web server hosted by a hosting company, you can connect to it through SSH to install software, configure services, manage files, and more.

Here are some examples of how to use SSH to connect to a remote server:

  1. Basic SSH connection:
ssh usuario@host_remoto

In this command, usuario is your username on the remote server and host_remoto is the server’s IP address or hostname. When you run this command, you will be asked for your account password on the server so you can connect.

  1. SSH connection with a public key:
ssh -i ruta/a/llave/privada usuario@host_remoto

In this case, a public key is used to connect to the server instead of a password. To use a public key, you must generate a public/private key on your local machine and share the public key with the server. The -i option specifies the path to the private key that will be used for the connection.

  1. Running remote commands with SSH:
ssh usuario@host_remoto 'comando'

You can run commands on the remote server directly from your local machine’s command line using SSH. Simply place the command you want to run inside single quotes after the SSH connection.

  1. Copying files through SSH:
scp ruta/a/archivo/local usuario@host_remoto:/ruta/a/archivo/remoto

You can copy files from your local machine to the remote server using the scp (Secure Copy) command with SSH. The local file path and the remote file path are specified after the username and host address.

The most common parameters in the SSH command are:

  • -p to specify a port other than the default (22)

  • -C to enable data compression during the transfer

  • -q to disable verbose output on the command line

  • -L to create a forwarding tunnel between two machines

  • -R to forward a port from the remote machine to the local machine

In summary, SSH is a very useful tool for connecting securely to remote servers and performing administration or maintenance tasks. I hope this brief introduction has helped you understand a little more about how it works. Stay tuned for upcoming articles, where we will explore other interesting uses of Secure Shell.