Knowledgebase Home / How to use Secure Copy Protocol(SCP) to Transfer Files Securely on Linux and Mac
// View Comments //

How to use Secure Copy Protocol(SCP) to Transfer Files Securely on Linux and Mac

Learn how to transfer files securely between computers or servers using SCP (Secure Copy) protocol in this step-by-step guide. SCP is a secure file transfer protocol based on SSH, allowing you to securely upload or download files from remote servers via the command line.

Quick Steps

    1. Open a terminal window.
    2. Upload files to your VeeroTech Hosting account with this command

      scp -P 22 filename username@example.com:~/destination
    3. Enter your password.
    4. Download files from your VeeroTech Hosting account with this command

      scp -P 22 username@example.com:~/file destination
    5. Enter your password when prompted, and SCP will download the file to the specified destination directory.

How to use Secure Copy Protocol(SCP) to Transfer Files Securely on Linux and Mac

Open the terminal window. Your operating system and desktop environment will determine how to do this. If you are on Mac OS X, click Applications, click Utilities, and then click Terminal

Type the following command to upload a file to your VeeroTech Hosting account.

scp -P 22 filename username@example.com:~/destination

Substitute the username with your VeeroTech Hosting username, and example.com for the domain name of your website/VeeroTech Server IP. We recommended using VeeroTech Server IP. Moreover, change the file to the name of the local file on your computer that you want to upload, and the destination to the destination directory on your VeeroTech Hosting account.

Note:  Make sure you use an uppercase P to specify the SCP port number. The default SCP port for SSH is 22. However, VeeroTech Hosting uses a different port for security reasons.

SCP command

SCP command

SCP command

SCP command

Type your password when you are prompted to do so. SCP uploads the file to the destination directory that you specified.

Type the following command to download a file from your VeeroTech Hosting account.

scp -P 22 username@example.com:~/file destination

Replace username with your VeeroTech Hosting username, and example.com with your site’s domain name/VeeroTech Server IP. Additionally, replace the file with the name of the file on your VeeroTech Hosting account that you want to download, and replace the destination with the destination directory on your local computer.

Note: We recommended using VeeroTech Server IP. To download the file to the current directory, type a period (.) for the destination.

SCP command

SCP command

Enter your password. and SCP downloads the file to the directory you specified as the destination. When using SCP, the following extra options might be helpful to you:

The -p option preserves the original file’s attributes, such as modification and access times.

You can recursively copy entire directories using the -r option. For example, enter the following command to download the entire public_html directory to the current directory on your local computer:

scp -rP 22 username@example.com:~/public_html .

Conclusion

Congratulations! You have learned how to use Secure Copy Protocol to transfer files securely on Linux and Mac operating systems.


If you have any web hosting questions please feel free to reach out to us. We're happy to help.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting

Our Guiding Principles

  • Provide consistent, stable, and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high-quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.
Subscribe to comment notifications
Notify of
guest
0 Comments
Inline Feedbacks
View all comments