+++
title = "Copy a file to or from a server"
description = "Send a note from the SD card to a server, or fetch a log from it, with scp in the Shell."
weight = 14
[extra]
tag = "SSH"
+++
One file at a time, between the SD card and a server you can log in to over SSH.
1. **Connect to the server once in the SSH App** (**SSH → New connection**, `user@host`) and trust its fingerprint. `scp` can't ask that question, so it only goes to servers it has met there.
2. For no password to type, put the device's key on the server: [Log in to a server without a password](/howto/ssh-key/). Without it, `scp` asks for the password.
3. Open the **Shell** and type, for a file going **to** the server:
```
scp /notes/a.txt user@host:docs/a.txt
```
or one coming **from** it, into a folder on the card (it keeps its name):
```
scp user@host:/var/log/syslog /logs/
```
You should see `scp: ... (1234 bytes) to ...`, then `scp: sent 1234 bytes in 310 ms` (or `received`).
4. If it says `password for host`, type it and press Enter: it shows as stars and is kept nowhere. Back cancels.
## If it doesn't work
| It says | Do |
|---|---|
| `is not a server this device trusts yet` | Step 1: connect once in the SSH App |
| `showed a different key than the one remembered` | The server was reinstalled, or something answers in its place. Check in the SSH App, which asks what to do |
| `exists already` | The file is on the card: add `-f` (`scp -f user@host:x /notes/x`) to replace it |
| `An SSH session is open` or `Not enough memory` | End the session (`ssh stop`), or close IRC or a Gemini page: [not enough memory](/howto/not-enough-memory/) |
| `not logged in`, `wrong password` | Three tries, then it stops. Check the user, or the key on the server |
| `a password is only asked in the Shell` | You typed it from a PC on the USB port or the Debug Console: use the Shell, or put the key on the server |
| `that isn't a plain file` | `scp` copies one file, not a folder |
Another port goes first: `scp -P 2222 /notes/a.txt user@host:a.txt`. `cancel` stops a copy that is running.