File transfer and remote server administration are key tasks for any IT professional or developer.
In this blog, we will explore two essential tools that facilitate these processes: SSH (Secure Shell) and SCP (Secure Copy Protocol).
SSH (Secure Shell) is a protocol that allows you to access or remotely manage a computer. It is based on the command line and can be used on Windows, Mac and Linux systems. Most servers, especially those running Linux, come with default SSH enabled.
Server: a "service" or program that is always running and is waiting to receive connections. When a connection is received, the credentials are validated and, if they are correct, the user acquires access and goes on to manage the equipment as if it was physically connected to it.
Client: a program that uses the SSH protocol so that a user can access another computer
Mainly on Linux, but there is also client and server for Windows.
SCP (Secure Copy Protocol also known as Secure Copy) is a secure copying protocol. The copy uses the SSH protocol to securely transfer files between teams. Allows secure loading and downloading (transfer) of files between local and/or remote equipment.
In SCP there are clients for Windows (WinSCP) and Linux (SCP).
Here we show you how you can use SCP to transfer files quickly and securely.
To make a file transfer between two teams, it is necessary:
To transfer an archive from your computer to a remote server, use this command in the terminal (Linux or Mac):
scp archivo.txt usuario@host:/ruta/de/destino/
This command will send the file 'archive.txt' to the destination folder on the remote server.
If you need to copy a file from the server to your computer, you can do it with this command:
scp usuario@host:/ruta/archivo_remoto.txt /ruta/destino/local/
This will download the file 'archiveremremot.txt' from the server to the local route on your computer.
To copy a full folder, including all files and subfolders, you can use the '-r' option (recursive):
scp -r directorio usuario@host:/ruta/de/destino/
This will move the entire folder to the destination location on the server.
If the remote server uses a port other than the standard port (22) for SSH, you can specify it with the --P- option:
scp -P puerto archivo usuario@host:/ruta/de/destino/
Only changes .port. by the number of the port used by the server.
cta:domains
Using Secure Shell (SSH) for file transfers offers a combination of security and efficiency that is difficult to overcome.
With SSH you can optimize your workflow and guarantee the integrity of your data during transfers.
In addition, understanding the role of SSH keys in authentication adds an additional layer of security to your operations on the server. With the right tools and knowledge at your disposal, you should find it easier to send files through SSH.