Skip to main content

Secure File Transfers

Chapter 22: Transfer Files Over SSH with scp

In this chapter, you'll learn what SCP is, how to copy files to and from remote servers, use recursive transfers, and understand where SCP falls short.

In the previous chapter, you set up a simple identity management system using ~/.ssh/config and IdentitiesOnly yes, ensuring that SSH automatically uses the right key for each server. With that, Module 6 is complete.

So far, every chapter has focused on SSH as a remote shell tool, connecting to servers, running commands, and managing authentication.

But SSH is also the foundation for something you will do constantly as a sysadmin or DevOps engineer: transferring files between machines securely.

You have 3 main tools for this: SCP, SFTP, and rsync, and each has its own use case.

In this chapter, we start with SCP, the simplest and most direct way to copy files over SSH.

If you have ever needed to pull a log file from a server, push a config file to a remote machine, or copy a directory between systems, SCP is often the fastest way to do it.

100+ Essential Linux Commands for Beginners (With Examples)
This course covers 100+ essential Linux commands that every Linux user, system administrator, and DevOps engineer should know.

What Is SCP

Pro TecMint Β· Root Plan
This Article is for Root Members
Join Root to read the full article and unlock everything

Full Access to Every Article, Course & Certification Track

Join thousands of Linux professionals who use Pro TecMint to advance their careers.

Ad-free access to all premium articles
All courses: Learn Linux, Bash, Golang, Ubuntu and more
RHCSA, RHCE, LFCS & LFCA certification prep
New courses added every month
Private Telegram community & priority support
Root Plan
$8/mo
or $59/year billed annually
Save $37 with annual plan
Start Reading This Article in the Next 60 Seconds
Join Root Plan β†’