Getting started

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.

BeginnerLinux server3 min read

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:

Bash
scp ./site.zip alex@203.0.113.25:/home/alex/

Download a file from the server:

Bash
scp alex@203.0.113.25:/var/backups/db/mariadb.sql.gz .

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

Bash
scp -r -P 2222 ./public alex@203.0.113.25:/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.

Bash
rsync -avz --progress ./public/ alex@203.0.113.25:/home/alex/public/

Interactive sftp

Bash
sftp alex@203.0.113.25

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.

Warning: Choose SFTP, not FTP or FTPS. Plain FTP sends your password unencrypted, and your server does not need an FTP service at all.

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:

Bash
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 MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.