Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsFor a single, straightforward transfer, use scp. For recurring copies, backups, or large directory trees, use rsync over SSH. Choose sftp when you need to browse a remote server and transfer selected files interactively. Every method depends on network reachability, an account that can log in to the destination, permission to read the source, and permission to write the destination.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
Choose the right transfer method
The three commands solve different problems. The OpenSSH documentation describes scp simply: “scp copies files between hosts on a network.” It uses the SFTP protocol over an SSH connection, so it has the same authentication and transport security as an SSH login. The rsync manual calls rsync “a fast and extraordinarily versatile file copying tool”; its delta-transfer algorithm avoids retransmitting data that is already identical at the destination.
As an Amazon Associate I earn from qualifying purchases.
| Need | Best fit | Reason |
|---|---|---|
| One file or one directory copied once | scp |
One command with minimal setup. |
| Repeated synchronization, mirroring, or a large tree | rsync over SSH |
Sends differences rather than recopying unchanged files and can retain selected metadata. |
| Browse, select, upload, download, or change permissions interactively | sftp |
Provides a remote shell-like file-management session. |
| Preserve links, permissions, owners, groups, or devices | rsync with suitable options |
Archive behavior requests metadata preservation, subject to account and filesystem limits. |
All examples below use the placeholders user, server-a, server-b, and paths that you must replace. They are command patterns, not claims that a transfer has been run.
Plan the transfer before sending data
Identify the direction first: local to remote, remote to local, or server to server. Then write down the exact source and destination paths, the account that will own the transferred files, and whether the destination already contains a directory with the same name. This prevents a technically successful transfer from putting data in the wrong location.
#1 Best Overall
Estimate whether the job is a one-time copy or a recurring synchronization. A one-time archive or configuration file rarely needs more than scp. A growing application-data tree benefits from rsync because subsequent runs can send only changed content. If a person must choose different files on each visit, SFTP’s interactive session avoids repeatedly editing a long shell command.
For a transfer between two remote hosts, also decide where the transfer process will run. Rsync cannot use one local process to connect independently to two arbitrary remote paths, so plan to execute it on one endpoint or stage the data through a machine with enough storage.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Check connectivity and permissions first
A transfer can fail even when the command syntax is correct. Check the destination before sending data.
- Confirm that DNS or routing can reach the destination server and that SSH access is available.
- Confirm the destination account and target directory. A successful login alone does not prove that the account can create files there.
- Confirm that the source account can read every file you intend to copy.
- Decide whether the destination needs ordinary user ownership or whether an administrator must adjust ownership afterward.
Use an SSH preflight check such as:
ssh user@server-b 'id && test -d /remote/path && test -w /remote/path'
The command prints the remote identity and succeeds only if /remote/path exists and is writable by that account. Inspect source access locally with:
ls -l /source/path
If the destination directory does not exist, create it with an account authorized to do so, or select a directory that already exists. Do not grant broad privileges merely to make a transfer work; a dedicated account with only the required access is safer.
Remember that directory access depends on every parent directory in the path. An account may have permission on the final directory but still be blocked by a parent without execute permission. Check the path as the same account that will run the transfer, rather than testing only with an administrator account.
Copy a one-off file with scp
Local server to remote server
From the machine containing the source file, run:
scp /local/path/file user@server-b:/remote/path/
The final slash identifies the destination directory. The account must be able to read the local file and write in the remote directory. If the destination filename should change, specify the complete remote path instead:
scp /local/path/file user@server-b:/remote/path/new-name
Copy a directory recursively
Add -r for a directory and its contents:
scp -r /local/path/directory user@server-b:/remote/path/
This generally creates a directory named directory beneath /remote/path/. Check the target first so you do not place a tree one level deeper or overwrite an unintended location.
Remote server to local machine
Run the command on the machine that should receive the file:
scp user@server-a:/remote/path/file /local/path/
For a remote directory, combine the remote source with -r:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Rank #2
scp -r user@server-a:/remote/path/directory /local/path/
Use a particular SSH identity
If the required private key is not the default identity, select it with -i:
scp -i /path/to/key /local/path/file user@server-b:/remote/path/
The private key should be readable only by its intended user. If the key has a passphrase, enter it when prompted or load it into an approved SSH agent; do not place the passphrase in a command or script.
What scp does and does not preserve
scp is convenient for a direct copy, but it is not a synchronization engine. Repeating the same command does not provide rsync’s difference-based update behavior. File ownership and other metadata may also be limited by the destination account, filesystem, and permissions. Use rsync when those requirements or repeatability matter.
Synchronize trees with rsync over SSH
Basic local-to-remote synchronization
Run:
rsync -avP /local/path/ user@server-b:/remote/path/
The options have distinct purposes: -a requests archive behavior, -v increases output, and -P combines progress reporting with retention of partial files. Rsync compares source and destination and transfers only the differences it detects, making it suitable for repeat jobs and large trees.
Free tools Windows power users keep installed
One-click scans. No signup required.
Run the first synchronization manually so you can read the file list and any warnings. Once the path and ownership behavior are understood, the same command can be used by a scheduled job under the dedicated transfer account. Keep the command’s source and destination consistent across runs; changing either one can create a second tree instead of updating the intended tree.
Understand the trailing slash
The slash after the source directory changes the result:
/local/path/means “copy the contents of this directory” into the destination./local/pathgenerally means “copy this directory itself,” creatingpathbeneath the destination.
Choose deliberately. A misplaced slash is a common reason for finding files under an unexpected extra directory after a migration. If you are unsure, use a dry run and inspect whether the output begins with the directory name you expect.
Preview changes before writing
Use a dry run when the destination matters or the path expression is unfamiliar:
rsync -avP --dry-run /local/path/ user@server-b:/remote/path/
Review the listed files, destination, and deletion-related options before removing --dry-run. The examples here do not request deletion; adding destructive synchronization options requires a separate, carefully reviewed decision.
Metadata and privilege limits
Archive mode requests preservation of attributes such as links, permissions, ownership, groups, and timestamps where rsync and the underlying system allow it. The result can still be constrained by the destination account, filesystem support, mount options, and whether the account is permitted to set owners or groups. If ownership cannot be set during transfer, copy the files with an authorized account and perform a controlled ownership adjustment afterward rather than granting unnecessary administrator access to the transfer account.
Metadata preservation is not the same as permission elevation. Rsync can request an attribute, but the destination kernel and filesystem still decide whether the account may set it. Plan separately for content transfer and any post-transfer ownership or group assignment.
Remote source and remote destination
The rsync manual states that rsync copies to or from a remote host or locally; it does not support arbitrary copying between two remote hosts from one local rsync process. Therefore, this apparent form is not a general solution:
Recommended Free Tools
rsync -avP user@server-a:/remote/path/ user@server-b:/remote/path/
Use one of these designs instead:
- Run rsync on
server-a, makingserver-bthe destination. For example, log in toserver-aand runrsync -avP /remote/path/ user@server-b:/remote/path/. Both endpoints must have rsync installed, and the account onserver-amust be able to authenticate toserver-b. - Stage the files through your local machine: pull from
server-a, then push toserver-b. This needs enough local storage and causes the data to traverse the local machine. - Use an approved administrative or backup workflow that runs a transfer process on one of the endpoints.
Do not assume that a local command can make one rsync process connect independently to two remote paths. Running the process on an endpoint also means checking that endpoint’s disk space, network route, SSH keys, and rsync installation before starting.
Use SFTP for an interactive session
SFTP is useful when you need to inspect a remote directory, transfer several selected items, or issue commands interactively rather than expressing the entire job in one shell command.
Start a session with:
sftp user@server-b
At the sftp> prompt, upload one file:
sftp> put /local/path/file /remote/path/file
Upload a directory recursively:
sftp> put -r /local/path/directory /remote/path/
When finished, close the session:
sftp> exit
The SFTP command set also includes a remote chmod operation for changing permissions when the account is allowed to do so. Use it narrowly and verify the resulting mode; changing permissions does not grant ownership or bypass filesystem restrictions.
Compared with scp, SFTP is less convenient for a scripted one-off because it requires an interactive session. Compared with rsync, it is not specialized for delta-based synchronization of an entire tree. Its advantage is control: you can inspect the remote location, transfer only the files selected during that session, and make a limited permission adjustment without building a larger automation script.
Set up key-based authentication for repeat transfers
Password prompts are acceptable for an occasional manual copy, but unattended backups and scheduled synchronization need a safer non-interactive authentication design. Install a public key for the destination account with:
ssh-copy-id user@server-b
The utility installs the key in that account’s authorized_keys file. Test the login independently before adding a transfer job:
ssh user@server-b 'id'
Keep the corresponding private key readable only by the intended local user. Protect a passphrase with an SSH agent or an organization-approved secret-management process. A key should belong to the limited-purpose account used for the transfer, not automatically to a highly privileged administrator account.
Use the same account and identity in the eventual scp, rsync, or sftp command that you tested with SSH. A key installed for one username does not authenticate a different destination account, and successful key authentication still does not grant write access to every directory.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #4
Verify the result and diagnose failures
Authentication errors
If SSH reports that authentication failed, verify the username, destination host, selected identity file, and whether the public key is installed for that exact account. Test with plain ssh first; fixing login independently makes scp, rsync, and SFTP failures easier to isolate.
Permission denied on the source
A transfer process can copy only files that its source account can read. Inspect ownership and mode with ls -l, then use an account with legitimate access or adjust permissions through your normal administration process.
Permission denied on the destination
Check the target directory with the preflight command. The account may be able to log in but lack write or execute permission on one of the parent directories. Select an authorized destination or have an administrator create and assign the directory; do not solve a directory problem by making the entire filesystem writable.
Unexpected directory nesting
With rsync, recheck whether the source ended in a slash. With scp, confirm whether you specified a destination directory or a complete filename. A dry run is the safest way to inspect rsync’s planned paths before writing.
Interrupted or incomplete transfer
Rsync’s -P option displays progress and retains partial files, which is useful when a large transfer is interrupted. Rerun the same command after connectivity is restored and inspect the output. For scp or SFTP, restart the operation and verify the resulting file size and application-level integrity when the data is important.
Metadata did not match
Archive mode cannot override destination restrictions. Confirm that the destination filesystem supports the requested attributes and that the account is allowed to set them. Ownership may require an authorized post-transfer step.
Transfer appears successful but the application cannot use the files
Check the destination path, owner, group, permissions, and completeness of the files from the perspective of the application account. A command returning without an obvious error confirms transport activity, not that an application has the expected access or directory layout.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Practical decision workflows
One configuration file or archive
Run scp from the source side, specify the destination account and directory, and verify the file remotely. Add -i only when a particular key is required.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Nightly application-data synchronization
Use rsync over SSH with archive, verbose, and progress options. First run the command with --dry-run, then schedule the reviewed command under a dedicated account with key-based authentication. Keep the source trailing-slash choice consistent so every run targets the same directory layout. Confirm that the account can read newly created source files and write the destination as the data set grows.
Selective manual collection
Open an SFTP session, inspect the remote location, use get or put for the specific files, and exit when finished. This avoids constructing a long command when the selection changes from one session to the next.
Best Value
Moving data directly between two remote servers
Do not launch a two-remote-path rsync command from your workstation. Run rsync on one server with the other as its SSH peer, or stage the data locally if endpoint execution and authentication cannot be arranged. In the staging design, account for local disk capacity and the fact that the data crosses the local machine.
Security and operational checklist
- Use a destination account limited to the directories and operations required.
- Confirm the source and destination paths before every first run.
- Use
--dry-runfor unfamiliar rsync jobs. - Protect private keys and use an agent or approved secret manager for passphrases.
- Do not assume a successful SSH login implies write permission.
- Consider ownership, groups, permissions, links, and filesystem support before relying on archive behavior.
- For important data, verify that the destination file is complete and usable, not merely that the command returned without an obvious error.
- When a transfer is scheduled, test the exact account, key, paths, and environment manually before relying on unattended runs.
Frequently Asked Questions
Should I use scp or rsync to copy files between Linux servers?
Use scp for a straightforward one-time file or directory copy. Use rsync over SSH for repeated synchronization, backups, or large trees because it transfers only differences and can request metadata preservation.
How do I copy a directory with scp?
Add the recursive option: scp -r /local/path/directory user@server-b:/remote/path/. Confirm the destination first, because this generally creates the source directory beneath the destination directory.
How can I avoid entering my password for every transfer?
Install an SSH public key for the destination account with ssh-copy-id user@server-b, then test ssh user@server-b 'id'. Protect the private key and use an SSH agent or approved secret manager for its passphrase.
Can rsync copy directly from one remote server to another?
Not from one local rsync process using two remote paths. Run rsync on one endpoint with the other as its destination, or stage the files through a local machine with enough storage.
What does the trailing slash in an rsync source path do?
A source ending in / copies the directory’s contents into the destination. Without the slash, rsync generally copies the directory itself and creates that directory beneath the destination.
Why does SSH work but the file transfer fail with permission denied?
Login permission and filesystem write permission are separate. Check the destination directory and every parent with the transfer account, and verify that the source account can read the files. An administrator may need to create the directory or adjust ownership.
When is SFTP better than scp?
SFTP is preferable when you need to browse a remote directory, select different files during each session, upload or download interactively, or issue a narrowly scoped remote permission command such as chmod.
Does rsync archive mode guarantee that owners and permissions will match?
No. Archive mode requests preservation, but destination account privileges, filesystem support, mount options, and ownership rules can prevent some attributes from being applied. Plan an authorized post-transfer ownership step when necessary.
The Bottom Line
Choose scp for a simple one-time copy, rsync -avP over SSH for repeatable synchronization, and sftp for interactive file selection. Check reachability and permissions first, use a dry run for unfamiliar rsync paths, protect SSH keys, and remember that rsync does not natively connect one local process to two remote hosts.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




