Files travel to and from your server over SSH, the same connection you use for commands. Nothing has to be installed on the server. This page shows three ways: a program with windows, the command scp for a quick copy, and rsync for large folders. The examples use a server with Ubuntu 26.04 LTS.

All commands on this page run on your computer, not on the server.


What You Need

1. With a Program: WinSCP or FileZilla

Both programs show your computer on one side and the server on the other, and you drag files between them. Enter these values in the login window:

FieldValue
ProtocolSFTP
Hostthe address of your server
Port22
Userroot or your own user
Passwordthe password of that user, or choose your key file instead

The windows of WinSCP are shown step by step in WinSCP: Transfer Files Between Your Computer and Your Service (SFTP and FTPS). That guide was written for App Hosting; with your server, use the SFTP part with the values from the table.

2. One Command: scp

scp is part of Windows, macOS and Linux. Open PowerShell or a terminal on your computer.

Copy a file to the server, into the folder /root:

scp notes.txt root@your-server:/root/

On Windows with the full path of the file:

scp C:\Users\Alex\Desktop\notes.txt root@your-server:/root/

Copy a whole folder with -r:

scp -r photos root@your-server:/root/

Copy a file or a folder from the server to your computer; the dot at the end means the folder you are in:

scp root@your-server:/root/notes.txt .
scp -r root@your-server:/root/photos .
  • Another SSH port: add -P 2222 (a capital P) after scp.
  • A key file: add -i and the path of the key, for example scp -i ~/.ssh/id_ed25519 notes.txt root@your-server:/root/.
  • The first connection asks whether you trust the server; answer yes.

3. Large Folders: rsync

rsync copies only what is missing or has changed. When the connection breaks, you run the same command again and it continues. It is part of macOS and Linux; on Windows, use WinSCP instead.

First see what would be copied. With n in the options nothing is changed, and the answer ends with (DRY RUN):

rsync -avPn photos/ root@your-server:/root/photos/

Then copy:

rsync -avP photos/ root@your-server:/root/photos/

And in the other direction, from the server to your computer:

rsync -avP root@your-server:/root/photos/ photos/
  • The slash at the end of the first folder means "the contents of this folder". Keep it on both sides as in the examples.
  • Another SSH port: add -e "ssh -p 2222".
  • A second run of the same command sends nothing when everything is already there.

4. A Few Files by Hand: sftp

sftp opens a small command line for files on the server:

sftp root@your-server
CommandWhat it does
ls, cd /root/photosLists and changes the folder on the server.
lcd DesktopChanges the folder on your computer.
put notes.txtCopies a file to the server.
get notes.txtCopies a file from the server.
byeCloses the connection.

5. After the Copy

If Something Does Not Work

Good to Know

Was this answer helpful? 0 Users Found This Useful (0 Votes)