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
-
- Open a terminal window.
-
Upload files to your VeeroTech Hosting account with this command
scp -P 22 filename username@example.com:~/destination
- Enter your password.
-
Download files from your VeeroTech Hosting account with this command
scp -P 22 username@example.com:~/file destination
-
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.
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.
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.