How to connect to a RunCloud server via SFTP
Tutorials
If you're a developer or agency working on a site hosted on a RunCloud server, the server administrator will usually ask you for an SSH key instead of giving you a password for SFTP. This is how we set up access for anyone working on a site we host: a key can't be guessed, and we can remove your access without touching anyone else's login.
The short version is this: you generate a key pair on your computer, send the public half to the server administrator, and keep the private half. Once your key is on the server, you point WinSCP at the private key and connect. This guide is for Windows; Mac users, see the note at the end.
What you'll need
- PuTTYgen, to generate the key. It comes with PuTTY, and WinSCP has a copy built in (on the "Login" window, click "Tools" > "Run PuTTYgen").
- WinSCP, to connect to the server.
- The server's IP address and your username, which the server administrator gives you.
Step 1: Generate your key in PuTTYgen
Open PuTTYgen. Under "Parameters" at the bottom, set "Type of key to generate" to "RSA" and change "Number of bits in a generated key" from 2048 to 4096 (2048 still works, but 4096 is the safer choice today).
Note: PuTTYgen can also make an Ed25519 key ("EdDSA" in newer versions), which is shorter and newer. I recommend RSA since every server and SFTP app accepts it, but if you'd rather use Ed25519, check with the server administrator first.
Click "Generate", then move your mouse around the blank area of the window until the green bar fills up. PuTTYgen uses the movement as randomness for your key.
Step 2: Label and protect your key
Once the key is ready, PuTTYgen shows it in the box at the top. Before you save anything:
- Change "Key comment" to your name and company, e.g. jason-acmeagency. This is how the server administrator tells your key apart from everyone else's.
- Type a passphrase into "Key passphrase" and "Confirm passphrase". If someone ever copies your private key file, they still can't use it without the passphrase.
Click "Save private key" and keep the .ppk file somewhere safe on your computer. This file is your login, so never email it, share it, or upload it anywhere, not even to the server administrator.
Step 3: Send your public key to the server administrator
Select everything in the box labelled "Public key for pasting into OpenSSH authorized_keys file", copy it, and send it to the server administrator. It's one long line that starts with "ssh-rsa" and ends with your key comment, something like:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC7... jason-acmeagency
Copy it from the box, not from the "Save public key" button; the saved file is in a different format that the server can't read as it is. The public key is safe to send by email or chat, since it's useless without the private key that stays on your computer.
Step 4: Set up the site in WinSCP
Once the server administrator confirms your key is added, open WinSCP. The "Login" window opens on its own; select "New Site" and fill in:
- "File protocol": SFTP
- "Hostname": the server's IP address
- "Port number": 22
- "Username": the username you were given
- "Password": leave it blank
Next, click "Advanced..." and go to SSH > Authentication. Under "Authentication parameters", click the "..." button next to "Private key file", choose the .ppk file you saved in Step 2, and click "OK".
Click "Save" and give the site a name you'll recognise (the client's domain works well), so you don't have to set this up again.
Step 5: Connect
Select the site and click "Login". The first time you connect, WinSCP says it doesn't recognise the server and asks whether to trust it; click "Accept" (if you want to be sure, ask the server administrator for the server's key fingerprint and compare). WinSCP then asks for your key passphrase, and you're in.
On a RunCloud server, each site's files are in /home/<username>/webapps/<app-name>/, so that's where you'll find the WordPress files.
If it doesn't connect
- WinSCP asks for a password, or says "Server refused our key": the key isn't on the server yet, or it was added to a different user than the one you typed. Check the username, then check with the server administrator.
- WinSCP can't open your .ppk file: update WinSCP. Newer PuTTYgen versions save keys in a format that WinSCP versions older than 5.20 can't read.
For Mac users: open Terminal, run ssh-keygen -t rsa -b 4096 -C "jason-acmeagency", and send the server administrator the contents of the .pub file it creates (usually ~/.ssh/id_rsa.pub). FileZilla and Cyberduck can both connect with that key.
Hope this helps.