How To Easily Transfer Files Over SSH Using SCP

Updated on May 14th, 2022
by Editorial Team

Introduction to transfer files over SSH

Transfer files over SSH - You need to move files from one Linux machine to another in a secure manner from time to time. You might want to backup or upload some files to a production server.

Far too often, you’ll need to download or unload a file to a remote server, and there are no other options than using an SSH connection (to transfer files over SSH). Fortunately, copying files over a secure connection is one of the protocol’s usual functions. On Linux computers, you can use the SCP command to do it.

What is SSH?

SSH, also known as Secure Shell or Secure Socket Shell, is a network protocol that allows users, especially system administrators, to access a computer across an insecure network in a secure manner.

The SSH protocol is also implemented by a set of utilities known as SSH. Secure Shell allows for robust password and public key authentication, as well as encrypted data exchange between two computers connected over an open network like the internet.

Both the cryptographic network protocol and the set of programs that implement it are referred to as SSH. The client-server model is used by SSH, which connects a Secure Shell client application, which displays the session, with an SSH server, which operates the session. Application protocols for terminal emulation and file transfers are frequently supported by SSH implementations.

Other application protocols can also use SSH to construct secure tunnels. By default, an SSH server listens on port 22 of the Transmission Control Protocol (TCP).

What is SSH used for?

SSH is included by default with every Unix, Linux, and Mac server in every data center. SSH connections have been used to secure a variety of communications between a local workstation and a remote host, such as secure remote access to resources, remote command execution, software patch and update delivery, and other administrative or management duties.

SSH is used to control routers, server hardware, virtualization platforms, operating systems and internal system management and file transfer programs, in addition to creating a secure channel between local and remote computers.

Connecting to servers, modifying files, uploading them, and exiting using tools or directly through the terminal is accomplished through the Secure Shell. Automating server access with SSH keys is common in scripts, backups, and configuration management.

What is SCP?

The SCP (Secure Copy) protocol is used to copy files over SSH. SCP is a system for securely moving files and entire folders between computers that is based on the SSH protocol. A client can securely submit (upload) files to a distant server or request (download) files using SCP. It can also be used to transmit files across remote servers.

Prerequisites to transfer files over SSH

If you are using CyberPanel, you can set up SSH access using CyberPanel SSH Manager

  • SSH File Transfer necessitates a remote host’s SSH service listening on an available network port (default 22).
  • To connect to the remote host, you’ll need to provide a username and password.
  • The transferred files must be stored in a writeable folder on the remote host’s disc.

Important configuration definitions**

  • Host - The remote host to which you connect is referred to as the host. It could be either a DNS name or an IP address.
  • Port - SSH/SFTP/SCP traffic is routed over a remote network port.
  • User - This is the username for the account that will be used to log in to the remote host.
  • Password - The password for the remote host account.
  • Protocol - The protocol used for communication is either SCP or SFTP.
  • Local File - The path to the file that needs to be transferred from a local host.
  • Remote File - The location on the remote host where the file will be sent.

How to transfer files over SSH?

  • Login to your SSH
Transfer Files Over SSH
  • Type the command
    ls -la
    to see all files and directories
  • Enter the command

scp [filename] [[email protected]:path]

Enter your password
your file transfer will start

  • Once completed, login to your second SSH

Write command: ls -la

To see all your files and folders (directories)

Your transferred file will be displayed here


To transfer files over an SSH connection (to upload or unload files to a remote server), you will need to upload or unload a file. As a rule, Protocol’s usual functions include copying files over secure connections. Linux users can do this by using SCP command.

4 comments on “How To Easily Transfer Files Over SSH Using SCP”

Leave a Reply

Your email address will not be published. Required fields are marked *