On a lot of WordPress sites I’m asked to work on, server access arrives as a single FTP username and password, pasted into an email. The same credentials have usually been shared with every developer, designer and agency that has touched the site over the years. Nobody knows who still has them. They’ve never been changed. And quite often, they’re plain FTP, which sends the password across the internet unencrypted. Using SSH keys for WordPress servers, with a separate login for each person, fixes most of these problems at once.
There’s a much better way, and it isn’t difficult to set up. Each person gets their own account. They authenticate with SSH keys instead of passwords. Their access is limited to the site they’re working on. And when they’re done, you remove one key or one user, and nobody else is affected.
This guide is aimed at site owners and developers managing their own VPS or a host that offers SSH. On fully managed hosting, the host’s control panel usually offers similar features, and the principles still apply.
Why plain FTP should be gone
FTP was designed in the 1970s. It sends usernames, passwords and files in clear text. Anyone able to see the network traffic, on a public Wi-Fi network for example, can read them.
SFTP is a completely different protocol that runs over SSH. Everything is encrypted. It works with the same file transfer apps people already use, like FileZilla, Cyberduck, WinSCP and Transmit. There’s no good reason to keep plain FTP enabled on a WordPress server today.
If your host still offers FTP, switch everyone to SFTP and disable FTP. If it doesn’t offer SFTP at all, that’s a strong reason to look at other hosts.
How SSH keys work
An SSH key pair has two parts. The private key stays on the user’s computer and should never be shared. The public key is placed on the server in a file called authorized_keys. When the user connects, the server checks that their private key matches one of the public keys it trusts.
The benefits over passwords:
- Keys are far too long to guess, so brute-force attacks against SSH become pointless.
- The private key never travels over the network.
- Each person has their own key, so you can remove one person’s access without affecting anyone else.
- Keys can be protected with a passphrase on the user’s computer, adding a second layer.
Generating a key
Each person generates their own key on their own computer. On macOS, Linux and modern Windows, the command is the same:
Ed25519 keys are short, fast and secure. The -C comment helps identify the key later, so include a name and device. When asked, set a passphrase.
The public key is saved as a file ending in .pub, usually ~/.ssh/id_ed25519.pub. That’s the part they send you. It’s safe to share by email or chat, because it can’t be used to log in without the private key.
Separate users for separate people
The simplest setup adds every public key to the same system user. That’s better than a shared password, but everyone still has the same permissions. A better approach is a separate Linux user for each person, or at least for each organisation.
Creating a user:
Paste their public key into authorized_keys. The –disabled-password flag means they can only log in with a key.
Giving users access to the site files
WordPress files are usually owned by a specific user, often www-data or a dedicated site user. Developers need to edit those files without breaking the permissions the web server relies on.
One clean approach is a shared group. Make the site files group-owned by a group such as “site-editors”, give the group write permission and add developers to it:
The setgid bit on directories means new files inherit the group, so permissions stay consistent as people upload files.
Be careful not to make everything writable by the web server user. Ideally, the web server can write to wp-content/uploads and cache folders but not to core files and plugins, which limits what an attacker can do if they exploit a vulnerability. How strict you can be depends on whether you update plugins through the dashboard or by deployment.
Restricting SFTP-only users to one site
Some people need to upload files but shouldn’t have a shell on the server at all. A designer replacing images, or a content person uploading large files, for example. For them, an SFTP-only user locked to one directory, called a chroot, is ideal.
In /etc/ssh/sshd_config, add a block at the end:
The chroot directory must be owned by root and not writable by the user, so the usual pattern is a root-owned folder with a writable subfolder inside, or a bind mount pointing to the part of the site they need. After editing, test the configuration and restart SSH:
Always keep a second SSH session open while changing SSH configuration, so a mistake doesn’t lock you out.
Hardening SSH itself
Once everyone is on keys, tighten the SSH server:
Disabling password authentication stops brute-force attacks completely. Disabling root login means people connect as their own user and use sudo when needed, which leaves a clearer record of who did what.
Consider also:
- A firewall that only allows SSH from known IP addresses, where practical.
- Fail2ban to block IPs that repeatedly fail to authenticate.
- Changing the SSH port reduces log noise, though it isn’t real security on its own.
Keeping track of keys
Keys only help if you know whose they are. Good habits:
- Require a meaningful comment on every key, with name and device.
- Keep a record of which keys are on which servers, alongside your general access inventory.
- Review authorized_keys files every few months and remove anything you can’t identify.
- When a person changes laptops, add their new key and remove the old one.
For teams managing many servers, tools like configuration management or a central key system help, but for a handful of servers a simple spreadsheet works.
Removing access
When someone’s work is done, removing access is simple:
- For a key on a shared user, delete their line from authorized_keys.
- For a dedicated user, lock or delete the account:
Locking first is useful if you want to keep their files temporarily. Check for any cron jobs they set up and any processes still running under their user before deleting.
Because each person had their own access, nobody else needs a new password. That’s the real payoff of doing this properly.
When the host controls access
On managed WordPress hosting, you often can’t create Linux users yourself. Most good hosts still let you:
- Create separate SFTP users per person
- Add SSH keys through the control panel
- Restrict access by site
- Remove users individually
Use those features rather than sharing the main account credentials. If your host only offers a single shared login, that’s worth raising with them or factoring into your next hosting decision.
A quick setup checklist
- Disable plain FTP and use SFTP only.
- Ask each person for their public SSH key.
- Create separate users, or at least separate keys with clear comments.
- Use groups to give appropriate write access to site files.
- Lock SFTP-only users to the directories they need.
- Disable SSH password authentication and root login.
- Record who has access and review it regularly.
It takes an hour or two to set up properly, and it removes a whole category of risk that most WordPress sites live with for years without thinking about it.
Access for automated tools
People aren’t the only ones who need server access. Backup services, deployment pipelines and monitoring tools often connect over SSH too. Give each of them its own key with a clear comment, such as “github-deploy” or “backup-service”, and where possible its own restricted user. If a deployment tool only needs to write to one theme folder, it shouldn’t be able to read wp-config.php or touch other sites on the same server.
When you review authorized_keys files, these automated keys are the ones most likely to be forgotten, because nobody leaves the company when a tool is replaced. Treat a retired service exactly like a departing person: remove its key the day you stop using it. Once SSH keys for WordPress servers become your default, sharing a password by email will feel as odd as it should.
Frequently asked questions
Can my client use SFTP without understanding SSH keys?
Yes. Apps like FileZilla and Cyberduck can use a key file, and setting it up once is straightforward. For less technical users, an SFTP-only account with a strong password and IP restriction is an acceptable compromise.
What if someone loses their private key?
They generate a new pair and send you the new public key. You remove the old one. Nothing else needs to change.
Is WP-CLI access over SSH a security risk?
WP-CLI is as powerful as administrator access. Only give SSH access to people you’d trust as WordPress administrators.
Should the web server be able to write to plugin folders?
If you update plugins through the dashboard, it needs to. If you deploy updates from Git or WP-CLI, you can make plugin and core files read-only for the web server, which significantly limits damage from many attacks.




