How-tos · SSH

Copy a file to or from a server

Send a note from the SD card to a server, or fetch a log from it, with scp in the Shell.

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. 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 saysDo
is not a server this device trusts yetStep 1: connect once in the SSH App
showed a different key than the one rememberedThe server was reinstalled, or something answers in its place. Check in the SSH App, which asks what to do
exists alreadyThe 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 memoryEnd the session (ssh stop), or close IRC or a Gemini page: not enough memory
not logged in, wrong passwordThree tries, then it stops. Check the user, or the key on the server
a password is only asked in the ShellYou 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 filescp 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.