Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Ubuntu 17.04 and 17.10 are both out of support. The commands below cover the OpenSSH tools from those releases for legacy-system use; upgrade to a supported Ubuntu release before exposing either system to the internet or transferring sensitive files. Ubuntu 17.04 reached end of life on January 13, 2018, and Ubuntu 17.10 on July 19, 2018. Ubuntu’s release list records those dates.
To copy a local file to a remote server, use scp file.txt username@remote_host:/remote/path/. To download one, reverse the source and destination: scp username@remote_host:/remote/path/file.txt ./. SCP transfers files through SSH, so the remote host must be reachable and accept your account’s authentication.
What you need before using SCP
scp means secure copy. It uses an SSH connection for authentication and encrypted transport; that does not by itself make an untrusted host, account, or private key safe. The local computer needs the OpenSSH client, while the remote computer needs a reachable SSH service, usually sshd.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, 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 minute- A remote username and hostname or IP address
- The SSH port, usually 22
- A password or configured SSH key
- Read permission for the source and write permission for the destination
SCP cannot bypass normal file permissions. Install the client locally if needed:
#1 Best Overall
- USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
- Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
- Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
- Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
- Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty
sudo apt update
sudo apt install openssh-client
If you administer the remote Ubuntu machine and its SSH server is not installed, install and start it there:
sudo apt update
sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
The remote firewall and network must also permit connections to the SSH port.
Test SSH before transferring files
Use the same remote account and host you intend to use with SCP:
Free tools Windows power users keep installed
One-click scans. No signup required.
ssh [email protected]
If this login fails, troubleshoot SSH connectivity or authentication before investigating SCP. On first connection, SSH may ask whether to trust the host key. Verify the server fingerprint through a trusted channel before accepting it; once accepted, the key is normally recorded in ~/.ssh/known_hosts.
If you see WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!, do not disable host-key checking or blindly accept the new key. First confirm that the server was reinstalled or that its key change is otherwise expected. If the change is legitimate, remove the old entry and reconnect to verify the new fingerprint:
ssh-keygen -R server.example.com
ssh [email protected]
Understand SCP source and destination paths
The general form is:
scp [options] SOURCE USER@HOST:DESTINATION
A remote operand uses [user@]host:path; a local operand is an ordinary local path. For example, [email protected]:/home/alice/report.pdf is a remote file, while ~/Downloads/ is local. An explicit absolute remote path is clearest. A remote path without a leading slash is relative to the remote user’s home directory, so [email protected]:backups/ refers to /home/alice/backups/ for this example account.
Use explicit ./ or absolute paths if a local filename contains a colon: the colon can otherwise be read as a host separator. In this historical SCP workflow, a tilde in a remote path is interpreted on the remote side; use an absolute path when you want to avoid ambiguity.
Copy a file from Ubuntu to a remote server
Give the local file first and the remote destination second:
Rank #2
- High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
- Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
- Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
- Sleek, durable metal casing
- Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]
scp /path/to/local/file.txt [email protected]:/home/alice/
For example:
scp ~/Documents/report.pdf [email protected]:/home/alice/Documents/
The destination directory must exist and be writable by Alice. At the first connection, SSH may prompt for host-key verification; after authentication, SCP normally shows a progress meter. A successful command returns to the shell without an error. Verify the remote copy with:
ssh [email protected] 'ls -l /home/alice/Documents/report.pdf'
Copy a file from a remote server to Ubuntu
Put the remote file first, followed by the local destination:
scp [email protected]:/home/alice/Documents/report.pdf ~/Downloads/
The local destination directory must exist. To choose a different local filename, provide the full destination filename instead:
scp [email protected]:/home/alice/Documents/report.pdf ~/Downloads/report-copy.pdf
A dot means the current local working directory:
scp [email protected]:/home/alice/file.txt .
Copy multiple files or a directory
Several files
List local files before the remote destination:
scp file1.txt file2.txt [email protected]:/home/alice/
A local wildcard is usually expanded by your local shell before SCP runs:
scp ~/Documents/*.pdf [email protected]:/home/alice/Documents/
Remote wildcards depend on the remote shell and filename quoting. For example, quoting the remote operand can ask the remote side to expand the pattern:
scp '[email protected]:/home/alice/Documents/*.pdf' ~/Downloads/
If a wildcard transfer fails, try an explicit filename first to separate path and quoting problems from connection problems.
Directories
Use -r to copy a directory tree recursively:
scp -r ~/project [email protected]:/home/alice/
This copies the project directory into Alice’s home directory. To download a remote directory:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
scp -r [email protected]:/home/alice/project ~/Downloads/
Check the destination layout and permissions before starting. Recursive SCP follows symbolic links encountered while traversing, so a symlink can cause additional files or directories to be copied. The Ubuntu OpenSSH SCP manual documents the operand syntax and recursive-copy behavior.
Rank #3
- What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
- Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
- Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
- Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
- Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers
Use a nonstandard SSH port
SCP uses uppercase -P for the port. For an upload on port 2222:
scp -P 2222 file.txt [email protected]:/home/alice/
For a download, apply the same option before the operands:
scp -P 2222 [email protected]:/home/alice/file.txt .
Do not confuse uppercase -P with lowercase -p, which preserves file times and mode bits.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Choose an SSH private key
If SSH requires a particular key, specify its local private-key file with -i:
scp -i ~/.ssh/id_rsa file.txt [email protected]:/home/alice/
Use the filename of the key that actually exists on your system; it might instead be something such as ~/.ssh/id_ed25519. Restrict the private key’s local permissions if necessary:
chmod 600 ~/.ssh/id_rsa
Test the same key with SSH first:
ssh -i ~/.ssh/id_rsa [email protected]
For public-key login, a basic setup is to create a key pair and install its public key on the remote account:
ssh-keygen -t rsa
ssh-copy-id [email protected]
ssh [email protected]
Check that ssh-copy-id is available with which ssh-copy-id. Protect private keys; for automated use, a dedicated key with a passphrase and an SSH agent is preferable where practical. Once a public key is accepted, SCP normally uses the same SSH authentication configuration as SSH.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsPreserve file timestamps and mode bits
Use lowercase -p to preserve modification time, access time, and file mode bits:
Rank #4
- GOOD VALUE PACKAGE - 1 Pack 32GB Memory Stick USB 2.0 Flash Drives with great cost performance and high quality.
- BIG CAPACITY - The available capacity: 29.10GB-29.8GB, You can save the data of movies, music, photos, designs, programs, manuals, handouts in a high speed.Good performance in digital data storing, transferring and sharing with families, friends, workmates, clients and machines.
- EASY TO USE & PLUG AND WORK - Support windows 7 / 8 / 10 / Vista / XP / 2000 / ME / NT Linux and Mac OS, Compatible with USB2.0 and below.
- TWISTTURN DESIGN & EASY CARRY - The metal clip rotates 360° round the ABS plastic body which with rubber oil skin feeling finish. The capless design can avoid lossing of cap, and providing efficient protection to the USB port.
- WARRANTY & SUPPORT - SIMMAX logo is laser printed on the USB connector surface, our products are of good quality and we promise that any problem about the product within one year since you buy.
scp -p file.txt [email protected]:/home/alice/
It does not make the destination file owned by the same user as the source, nor does it override the destination account’s privileges, filesystem rules, or directory permissions. Combine it with recursive copying when appropriate:
scp -p -r project/ [email protected]:/home/alice/
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common SCP errors
scp: command not found
The local OpenSSH client may be missing. Install it with:
sudo apt update
sudo apt install openssh-client
Check the installed command’s options with man scp.
Connection refused or timed out
Check that you have the right host and port and that the remote SSH service is running. On the remote machine, inspect the service and listening sockets:
sudo systemctl status ssh
sudo ss -tlnp | grep ssh
If SSH listens on port 2222, test that connection first, then use the matching uppercase port option with SCP:
ssh -p 2222 [email protected]
scp -P 2222 file.txt [email protected]:/home/alice/
A firewall or incorrect network address can also prevent a connection.
Permission denied
Distinguish login failure from inability to access a destination. A message such as Permission denied (publickey,password) points to authentication: check the username, accepted login method, password or key, and key-file permissions. A message naming a destination path usually means the remote account cannot write there. Inspect it over SSH:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →ssh [email protected] 'ls -ld /destination/path'
For a protected destination, first copy to a directory Alice can write, then move the file remotely with appropriate administrative privileges:
Best Value
- 【16GB Flash Drive】USB flash drives with 16GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer. IMEASON thumb drives can be used to store different files, easy to data backup.
- 【Metal Swivel Cap Design】USB thumb drive is metal swivel cover provides extra protection for the usb thumbdrive connector, no usb drive cap to lose; keychain design makes it easier to carry without worrying lose it.
- 【Wide Compatibility】USB drive supports Windows 7/8/10/11 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also Supports USB 2.0 and 1.1 ports. USB Stick support TV, desktop, notebook computer, car, audio and other device. The USB Memory Stick is your great data storage and transfer companion with traveling and working.
- 【Easy to use】usb memory stick is plug and play without any software installation. Just simply plug the Flashdrive into the port of your USB-compatible devices such as computer, laptop to start data storage or transmission.
- 【What You Get】16 GB USB Flash Drive Thumb Drive, The default format of the usb storage flash drive is FAT32.
scp file.txt [email protected]:/home/alice/
ssh [email protected] 'sudo mv /home/alice/file.txt /protected/path/'
Running local scp with sudo does not grant the remote account additional privileges.
No such file or directory
Check the local and remote paths independently, including capitalization, spelling, and whether the destination directory already exists:
ls -ld /local/path/
ssh [email protected] 'ls -l /remote/path/'
If the remote destination is missing, create it before transferring:
ssh [email protected] 'mkdir -p /home/alice/backups'
scp backup.tar.gz [email protected]:/home/alice/backups/
Hostname cannot be resolved
Check whether the name resolves:
getent hosts server.example.com
If you have confirmed the host’s IP address, try it directly:
scp file.txt [email protected]:/home/alice/
For a local-network hostname, confirm that the computer is on the expected network and that local name resolution is working.
Get more diagnostic detail
Verbose mode prints SSH and SCP debugging information that can help locate connection, authentication, or configuration failures:
scp -v file.txt [email protected]:/home/alice/
For more detail, use -vvv. Avoid sharing logs without checking them for hostnames, usernames, paths, or other sensitive information.
Recommended Free Tools
When SCP is not the best fit
SCP is convenient for one-off copies, but it does not provide incremental synchronization, version history, automatic mirroring of deletions, or a backup system. It is also not designed as a robust resume-oriented workflow for unreliable large transfers.
| Need | Consider | Why |
|---|---|---|
| One file or a few files | scp |
Short command for a direct copy. |
| Interactive remote browsing | sftp |
Provides an interactive transfer session: sftp [email protected]. |
| Repeated directory synchronization | rsync over SSH |
Can transfer changed data between runs; for example, rsync -avz -e ssh ~/project/ [email protected]:/home/alice/project/. |
| Large or unreliable transfers | rsync or another resumable transfer tool |
Offers recovery options better suited to interrupted transfers than a basic SCP copy. |
Compatibility with current OpenSSH
Ubuntu 17.x clients used the older SCP transfer behavior. Since OpenSSH 9.0, modern scp uses SFTP by default; -O selects the legacy SCP protocol in those newer clients. This version change can matter when a current client connects to an old server, but -O is not a normal option to add to the Ubuntu 17.x commands here. Check the manual installed on the machine you are actually using. The current Ubuntu SCP manual documents modern behavior.
Quick Recap
Quick command reference
| Task | Command |
|---|---|
| Upload a file | scp file.txt [email protected]:/home/alice/ |
| Download a file | scp [email protected]:/home/alice/file.txt ./ |
| Copy a directory | scp -r project/ [email protected]:/home/alice/ |
| Use port 2222 | scp -P 2222 file.txt [email protected]:/home/alice/ |
| Choose a key | scp -i ~/.ssh/id_rsa file.txt [email protected]:/home/alice/ |
| Preserve times and modes | scp -p file.txt [email protected]:/home/alice/ |
| Debug a failure | scp -v file.txt [email protected]:/home/alice/ |
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.

