BLACKBOXHelp Center

Transferring files to the server (scp, rsync, SFTP)

How to copy files between your computer and your server with scp, rsync or a graphical SFTP client (FileZilla, WinSCP).

generalUpdated 2026-10-09~11 min read
On this page

You copy files to and from the server over SSH too, with the same details you use to connect: the IP address, the user root, port 22, and the password or SSH key. You'll find the IP address in the app.blackbox.md panel, under “My Servers” (app.blackbox.md/my-servers; from blackbox.md: “Contul meu” (My account) → “Panou de administrare” (Admin panel) → “My Servers”), in the “IP” field on the server card.

Available to: the blackbox.md account holder who has an active server and the root credentials (the password or an SSH key): Connecting to your server over SSH (Windows, macOS, Linux). For dedicated servers, you agree on the access details with our team.

The blackbox.md website is available in Romanian and Russian; this article quotes the Romanian labels with their English meaning.

Which tool to choose

Tool Best for Systems
scp one file or folder, one time macOS, Linux, Windows 10 and 11
rsync large folders, repeated copies, resuming after an interruption macOS, Linux; Windows through WSL
sftp a session in which you browse the server macOS, Linux, Windows 10 and 11
FileZilla, WinSCP working with the mouse, no commands FileZilla: all; WinSCP: Windows

All of them use SSH, so your data travels encrypted. You run the scp, sftp and rsync commands on your computer, not on the server. Replace SERVER_IP with your server's address.

scp: quick copy

scp comes installed on macOS and Linux. On Windows 10 and 11, it is part of the OpenSSH client, along with ssh and sftp: run it in PowerShell, with the same syntax.

Upload a file to /root on the server:

scp backup.zip root@SERVER_IP:/root/

The destination directory must exist before you copy. A new server without a web server doesn't even have /var/www; create it from your computer:

ssh root@SERVER_IP "mkdir -p /var/www/site"

Upload a folder with -r (/var/www/site appears on the server):

scp -r site root@SERVER_IP:/var/www/

Download a file into the current directory (the dot at the end), and a whole folder:

scp root@SERVER_IP:/root/backup.tar.gz .
scp -r root@SERVER_IP:/var/www/site ./site-backup

To use a specific key, add -i. If SSH listens on a port other than 22 (for example, on another provider's server; BLACKBOX servers use port 22), add -P, with a capital P, unlike ssh -p:

scp -i ~/.ssh/id_ed25519 -P PORT backup.zip root@SERVER_IP:/root/

In PowerShell, write local paths the Windows way:

scp -r C:\Users\USERNAME\Documents\site root@SERVER_IP:/var/www/

sftp: interactive session

The -i and -P options work the same way as with scp.

sftp root@SERVER_IP
Command at the sftp> prompt What it does
ls, cd /var/www/site lists the directory and changes it on the server
lls, lcd site the same on your computer
put index.html, put -r assets uploads a file or a folder
get config.php, get -r uploads downloads a file or a folder
exit closes the session

rsync copies only the differences: on the second run, it transfers only new or changed files, and an interrupted copy picks up where it left off. It must be installed on both ends. macOS includes it; on Linux, install it from the package manager if it's missing; on Windows, run it from WSL (Windows Subsystem for Linux). Without WSL, use scp or WinSCP. If it's missing on the server, install it:

Ubuntu and Debian:

apt update
apt install -y rsync

AlmaLinux and CentOS Stream:

dnf install -y rsync

Upload the contents of the local site folder to /var/www/site:

rsync -avz --progress site/ root@SERVER_IP:/var/www/site/
Option What it does
-a copies recursively, keeping permissions, modification times and symbolic links
-v, --progress shows the files and the progress
-z compresses data in transit; helps with text, not with archives, images or video
--partial keeps a partially copied file so that the next run can continue it
-P --partial --progress (with scp, -P is the port)
-n dry run (--dry-run): shows what would happen, without changing anything
--delete deletes files from the destination that no longer exist in the source

The trailing slash on the source matters: site/ copies the folder's contents, while site adds an extra level, /var/www/site/site.

A large file, with resume (if the connection drops, run the same command again):

rsync -avP backup.tar.gz root@SERVER_IP:/root/

Download a folder from the server:

rsync -avz --progress root@SERVER_IP:/var/www/site/ ./site-backup/

To use a different port or a specific key, pass them with -e:

rsync -avz --progress -e "ssh -p PORT -i ~/.ssh/id_ed25519" site/ root@SERVER_IP:/var/www/site/

An exact copy with --delete

To make files you deleted locally disappear from the server as well, add --delete. Do a dry run with -n first: the deleting … lines are the files that will be deleted.

rsync -avzn --delete site/ root@SERVER_IP:/var/www/site/

If the list is correct, run the same command without the n:

rsync -avz --delete site/ root@SERVER_IP:/var/www/site/

Risk With --delete, a path mistake (a missing slash, the source and destination swapped, an empty local folder) can delete the files on the server, and BLACKBOX does not make automatic backups of your server. Run the command with -n first, and make a backup beforehand: Backup strategy for your server.

FileZilla (Windows, macOS, Linux)

FileZilla Client is free: the official FileZilla website. The labels below are from the English interface; in the Romanian or Russian interface, they are translated.

  1. Open “File” → “Site Manager...” and click “New site”.
  2. Fill in:
    • “Protocol”: “SFTP - SSH File Transfer Protocol” (not “FTP”);
    • “Host”: the IP address; “Port”: 22; “User”: root;
    • “Logon Type”: “Normal”, with the root password in “Password”, or “Key file”, with the private key selected through “Browse...” (a .ppk file or an OpenSSH key, for example id_ed25519). On macOS, the .ssh folder is hidden: in the file picker, press Cmd + Shift + G and type ~/.ssh. If FileZilla offers to convert the key, accept.
  3. Click “Connect”.
  4. The first time you connect, “Unknown host key” appears: check “Always trust this host, add this key to the cache” and click “OK”.
  5. Drag files between the left pane (your computer) and the right pane (the server).

You can add the key once for all SFTP connections: “Edit” → “Settings...” (on macOS: “FileZilla” → “Settings...”) → “Connection” → “SFTP” → “Add key file...”.

In the “Quickconnect” bar, either enter sftp://SERVER_IP in “Host” or enter 22 in “Port”. Otherwise, FileZilla tries FTP and the connection fails.

WinSCP (Windows)

WinSCP is free: the official WinSCP website. The labels below are also from the English interface. When WinSCP starts, the “Login” window opens.

  1. Select “New Site” and fill in: “File protocol”: “SFTP”; “Host name”: the IP address; “Port number”: 22; “User name”: root; “Password”: the root password (on a “Password + key” server).
  2. For a key: “Advanced...” → “SSH” → “Authentication” → “Private key file”, and choose the .ppk file you use in PuTTY. If you choose an OpenSSH key, WinSCP offers to convert it to .ppk: accept. Click “OK”.
  3. Click “Save”, then “Login”.
  4. The first time you connect, confirm the server's key with “Accept” (“Yes” in older versions).
  5. Drag files between the left pane (your computer) and the right pane (the server).

“Key-only” servers

On a server with the “Key-only” badge (on its card in “My Servers”), the root password doesn't work over SSH, so it doesn't work in scp, sftp, rsync, FileZilla or WinSCP either. Set up the key in your client:

  • scp, sftp and rsync try the standard keys in ~/.ssh on their own (for example id_ed25519); specify a different key with -i (for rsync, inside -e);
  • FileZilla: “Logon Type” “Key file”, or the key in “Settings”; WinSCP: “Private key file”.

Without the right key, you get Permission denied (publickey), and in FileZilla and WinSCP, No supported authentication methods available (server sent: publickey). To add a new computer's key, use “Add SSH key”: Adding and removing SSH keys on the server. To turn password login back on, use “Enable password login”: Enabling and disabling SSH password login.

After uploading a site: owner and permissions

Files uploaded as root belong to root (and rsync -a even keeps the user ID from your computer). The web server must be able to read them, and the application must be able to write to its own directories (uploads, cache). Give ownership to the user that the web server or PHP-FPM runs as:

System nginx Apache PHP-FPM (default)
Ubuntu, Debian www-data www-data www-data
AlmaLinux, CentOS Stream nginx apache apache

The actual user appears on the lines that don't start with root:

ps -eo user,comm | grep -E 'nginx|apache2|httpd|php-fpm'

Ubuntu and Debian

chown -R www-data:www-data /var/www/site
find /var/www/site -type d -exec chmod 755 {} +
find /var/www/site -type f -exec chmod 644 {} +

AlmaLinux and CentOS Stream

Use the same commands with the user from the table (for example nginx:nginx or apache:apache). In addition, SELinux is active by default and checks the label of every file. Files can end up with the wrong label (for example, files moved with mv from /root keep their old label), and then the site responds with 403 Forbidden. After uploading, restore the labels:

restorecon -Rv /var/www/site

For the application to be able to write to a directory (for example uploads), SELinux requires a separate label for it. Replace the path with your own directory:

dnf install -y policycoreutils-python-utils
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/site/uploads(/.*)?"
restorecon -Rv /var/www/site

Installing the web server: Web server with HTTPS: nginx or Apache and Let's Encrypt.

Long transfers: tmux or screen

When you copy from your computer, you resume an interrupted rsync copy by running the same command again with -P. When you copy between two servers (for example, from your old hosting to the new server), run the copy on the server inside a tmux session: if the SSH connection drops, the copy keeps going.

Install tmux if it's missing. Ubuntu and Debian:

apt update
apt install -y tmux

AlmaLinux and CentOS Stream (on these systems, screen is not in the standard repositories):

dnf install -y tmux
Action tmux screen
start a session tmux new -s transfer screen -S transfer
leave without stopping it Ctrl + B, then D Ctrl + A, then D
return after reconnecting tmux attach -t transfer screen -r transfer

Example: the command below, run inside the session on the new server, pulls the site from the old server. It asks for the old server's root password; if you log in there with a key, follow the moving guide linked below.

rsync -avzP root@OLD_SERVER_IP:/var/www/site/ /var/www/site/

The complete move: Moving a site to a BLACKBOX server.

Why SFTP and not FTP

  • VPS servers for which you choose the operating system when you order come with no FTP server installed. SFTP works right away, over SSH, with the root credentials.
  • FTP sends the password and the files unencrypted; SFTP encrypts them. Don't confuse SFTP with FTPS (“FTP over TLS”), which requires an FTP server.
  • The network filtering managed by BLACKBOX lets through only SSH (22), HTTP (80), HTTPS (443) and ping by default. The ports of an FTP server you install yourself would not be reachable from the internet without a request to support: Firewall: network filtering and ufw/firewalld on the server.
  • On “VPS hosting” plans, ask support whether the control panel on the server includes FTP: “VPS hosting” plans with a control panel.

Common errors

Message Likely cause What to do
Permission denied (publickey) or No supported authentication methods available (server sent: publickey) a “Key-only” server; the key is not set up in the client or not installed on the server specify the key (-i, “Key file”, “Private key file”) or add it with “Add SSH key”
Permission denied, please try again. (FileZilla: Authentication failed.) wrong password copy the password with “Reveal credentials”: Showing root credentials
FileZilla: Could not connect to server, with port 21 in the log the FTP protocol was selected choose “SFTP - SSH File Transfer Protocol”, port 22
rsync: command not found rsync is missing on the server or on your computer install it
No space left on device the server's disk is full The server's disk is full
No such file or directory when uploading the destination directory doesn't exist on the server create it, as shown in the scp section
403 Forbidden on the site after uploading wrong owner, permissions or SELinux labels see the section on owner and permissions

Other connection problems: I can't connect over SSH.

Frequently asked questions

Where do I put the site's files? In the directory set in the web server's configuration (root in nginx, DocumentRoot in Apache), usually under /var/www/.

Copying lots of small files takes a long time. What can I do? Make an archive on your computer, copy it to /root/ with scp, and extract it on the server. On your computer, then on the server:

tar czf site.tar.gz site
tar xzf /root/site.tar.gz -C /var/www/

How do I download my data before deleting the server? Use rsync or scp -r in the opposite direction, from the server to your computer, for each important directory. Export your databases to a file (a dump) first. What to include: Backup strategy for your server.

Didn't find your answer?Write to us and the support team will reply. support@blackbox.md
Open a ticket