−25%

on annual Windows plans, until 31 Oct. See plans

EQVPS

How to transfer files to a VPS: scp, rsync and SFTP

Copy files to and from your server with scp, sync big folders with resumable rsync, or use an SFTP client — including NAT plans with a custom SSH port.

Sooner or later you need to get files onto the server: a site build, a database dump, a config you wrote locally. You don't need an FTP server for this — SSH already gives you three good tools. All examples use documentation addresses; replace them with your server's.

Know your connection details

scp: copy a file or folder

Upload a file:

scp backup.sql root@203.0.113.10:/root/

Download one:

scp root@203.0.113.10:/var/log/nginx/access.log .

A whole folder:

scp -r ./site root@203.0.113.10:/var/www/

On a NAT plan, add the port with a capital -P:

scp -P 20123 backup.sql root@your-nat-host:/root/

rsync: the right tool for folders

rsync sends only the differences, shows progress and resumes if the connection drops. It must be installed on both ends (apt install -y rsync).

rsync -avzP ./site/ root@203.0.113.10:/var/www/site/

With a custom SSH port:

rsync -avzP -e "ssh -p 20123" ./site/ root@your-nat-host:/var/www/site/

To make the destination an exact mirror (deleting files you removed locally), add --delete — but preview first:

rsync -avzP --delete --dry-run ./site/ root@203.0.113.10:/var/www/site/

Mind the trailing slash. ./site/ copies the contents of site; ./site copies the folder itself into the destination. With --delete, that difference decides which directory gets emptied.

SFTP: interactive or graphical

The command-line client works like a tiny file manager:

sftp -P 20123 root@your-nat-host
sftp> put backup.sql
sftp> get /etc/nginx/nginx.conf
sftp> exit

Prefer a GUI? FileZilla, WinSCP or Cyberduck connect with the same details: protocol SFTP, your host, port 22 (or your NAT port), user root, and your SSH key or password.

Faster with SSH keys

Every tool above uses SSH, so an SSH key means no password prompts — and lets you script transfers from cron. If you haven't set one up yet: SSH key authentication. New EQVPS servers accept the root password from the dashboard until you switch to keys, which we recommend doing on day one.

Big transfers

For tens of gigabytes, rsync is the only sane choice: if the connection drops, run the same command again and it continues where it stopped. Run it inside tmux or screen on the machine that sends, so closing your laptop doesn't kill it.

FAQ

What's the difference between scp and rsync?

scp copies everything every time. rsync compares both sides and sends only what changed, can resume interrupted transfers and can mirror a folder. For one file, scp is fine; for folders you sync repeatedly, use rsync.

How do I use a non-standard SSH port?

scp and sftp take a capital -P (scp -P 20123), ssh takes a lowercase -p, and rsync passes it through: rsync -e 'ssh -p 20123'. On EQVPS NAT plans, the personal SSH port is shown in the dashboard.

Can I use a graphical client?

Yes. Any SFTP client — FileZilla, WinSCP, Cyberduck — works with the same host, port, user and SSH key or password you use for SSH. Pick the SFTP protocol, not FTP.

Does this work from Windows?

Windows 10 and 11 include OpenSSH, so scp and sftp work in PowerShell as written here. rsync isn't included; use it from WSL, or use WinSCP's synchronize feature instead.

What does the trailing slash in rsync mean?

'rsync -a site/ dest/' copies the contents of site into dest. 'rsync -a site dest/' creates dest/site. Get it wrong with --delete and you can wipe the wrong folder, so run with --dry-run first.

Comments

No comments yet. Be the first.

Leave a comment

Comments are moderated before they appear.