Transfer files to your Linux VPS with SCP, SFTP, WinSCP or FileZilla

Move files to and from your server securely: scp and rsync in the terminal, interactive sftp, or the WinSCP and FileZilla apps over SFTP with your SSH key.

  • Beginner
  • Linux VPS
  • 3 min read

By RunRacks Team · Published

Your server already supports secure file transfer: anything that can log in over SSH can also copy files with SCP or SFTP. There is no need to install or open an FTP server.

Command line: scp

scp is built into Windows 10/11 (PowerShell), macOS and Linux. Run it on your own computer.

Upload a file to the server:

Terminal
scp ./site.zip [email protected]:/home/alex/

Download a file from the server:

Terminal
scp [email protected]:/var/backups/db/mariadb.sql.gz .

Copy a whole folder with -r, and use a capital -P for a custom SSH port:

Terminal
scp -r -P 2222 ./public [email protected]:/home/alex/

Command line: rsync (best for big or repeated copies)

rsync only sends what changed and can resume. It is on macOS and Linux; on Windows use it through WSL.

Terminal
rsync -avz --progress ./public/ [email protected]:/home/alex/public/

Interactive sftp

Terminal
sftp [email protected]

Inside, use ls, cd, put file to upload, get file to download and exit to leave.

WinSCP (Windows)

  1. Install WinSCP from winscp.net.
  2. In the login window choose File protocol: SFTP, enter the server IP as Host name, port 22 (or yours), and your username.
  3. To log in with a key, click Advanced → SSH → Authentication and select your private key. WinSCP offers to convert an OpenSSH key to its .ppk format.
  4. Click Save, then Login. Drag files between the panels.

FileZilla (Windows, macOS, Linux)

  1. Open File → Site Manager → New site.
  2. Set Protocol to SFTP - SSH File Transfer Protocol, enter the host and port.
  3. Choose Logon Type: Normal with your password, or Key file and select your private key.
  4. Click Connect.

Putting files where root owns the folder

Your user usually cannot write to folders such as /var/www directly. Upload to your home folder first, then move the files over SSH and set the owner your web server expects:

Terminal
sudo mv ~/public/* /var/www/example.com/html/
sudo chown -R www-data:www-data /var/www/example.com/html    # Ubuntu / Debian
sudo chown -R nginx:nginx /var/www/example.com/html          # AlmaLinux / Rocky

Troubleshooting

  • Permission denied when uploading: you are writing to a folder your user does not own. Upload to your home folder, then use sudo mv.
  • Connection refused or timed out: the same causes as SSH. See Fix SSH connection errors.
  • Transfers are slow: many small files are slow over any protocol. Pack them first with tar -czf site.tar.gz public/, copy one file, then unpack.

Next steps

Was this guide helpful?

Still stuck?

Ask RunRacks AI for a quick answer, or open a ticket and our team will take a look at your server.

Getting started

Edit files with nano: a beginner's guide

Open, edit, search and save files with the nano text editor on a Linux server, including cutting and pasting lines, showing line numbers and safely editing system config files with sudo.

  • Beginner
  • Linux VPS
  • 5 min read

Getting started

Your first hour with a new RunRacks server

A step-by-step roadmap for the first hour after your RunRacks server is delivered, from finding your login details to changing the password, updating the OS and picking your next guides.

  • Beginner
  • All
  • 5 min read

Getting started

How to choose a server location

Pick a data center location based on where your users, broker or team are, confirm it with ping tests, and weigh the legal and latency points that come with each choice.

  • Beginner
  • All
  • 4 min read