Skip to main content

How can I add an SSH key to Wordify?

Log in to your site over SSH and SFTP with a key instead of a password. Generate a key pair, add the public key from the command line, and connect.

Written by Daniel

Every Wordify site can be reached over SSH and SFTP using the username and password shown in the Console. If you would rather log in with an SSH key, which is handy for deployment tools, scripts, and password-free logins, you can add your public key to the site yourself in a couple of minutes.

There is no key manager in the Console. You add the key from the command line, exactly as you would on any Linux server, and it works for both SSH and SFTP.


Before you start

  • Your site's SSH details. Open the site in the Console, then under Hosting select SSH / SFTP. You will need the Host, Port, Username, and Password shown there. See Connecting over SSH and SFTP if you have not used them before.

  • A terminal. Terminal on macOS, any Linux shell, or PowerShell on Windows 10 and later, which all include the OpenSSH tools used below.

In the commands below, replace USERNAME and HOST with the values from your site's SSH / SFTP page.


Step 1: Create a key pair

Skip this step if you already have a key you want to use.

  1. Run: ssh-keygen -t ed25519 -C "[email protected]"

  2. Press Enter to accept the default file location. You can add a passphrase for extra protection, or leave it empty.

  3. This creates two files in your .ssh folder: id_ed25519 is your private key, which stays on your computer and is never shared. id_ed25519.pub is your public key, which is the one you add to the site.

  4. Display the public key so you can copy it: cat ~/.ssh/id_ed25519.pub

The public key is a single line that starts with ssh-ed25519. Copy the whole line, including the comment at the end.


Step 2: Add the public key to your site

Pick whichever option suits you. Both do the same thing.

Option A: use ssh-copy-id (macOS and Linux)

  1. Run: ssh-copy-id -i ~/.ssh/id_ed25519.pub USERNAME@HOST

  2. When prompted, enter the site's SSH / SFTP password from the Console. The tool copies the key into place and sets the right permissions for you.

Option B: add it by hand (works everywhere, including Windows)

  1. Log in to the site with the password: ssh USERNAME@HOST

  2. Run these four commands, pasting your public key in place of PASTE_YOUR_PUBLIC_KEY_HERE:

mkdir -p ~/.ssh

chmod 700 ~/.ssh

echo "PASTE_YOUR_PUBLIC_KEY_HERE" >> ~/.ssh/authorized_keys

chmod 600 ~/.ssh/authorized_keys

When the commands finish, type exit to log out.

Each key goes on its own line in authorized_keys, so you can add a key for every person or tool that needs access.


Step 3: Connect with the key

  1. Run: ssh USERNAME@HOST

  2. You should land on the server without being asked for a password. If your key is not in the default location, point to it: ssh -i /path/to/private_key USERNAME@HOST

Most SFTP clients, including FileZilla and Cyberduck, can use the same key. Choose key-based authentication in the client's connection settings and select your private key file.


Good to know

  • The password keeps working. Adding a key does not disable password logins for the site.

  • Keys survive a password rotation. Rotating the SSH / SFTP password in the Console does not remove any keys. To take someone's access away, delete their line from ~/.ssh/authorized_keys as well as rotating the password. See How do I update my SSH Password?

  • Keys are per site. Every site has its own username and home folder, so add your key to each site you want to reach.

  • Scripts and deployment tools use the server's default PHP. When a command is run non-interactively over SSH, for example by a deployment tool or a cron job, php is the server's default command-line version rather than the version your site is set to. To use a specific version, call it directly, such as /usr/local/php84/bin/php. Run ls /usr/local/php*/bin/php to see the versions available.


Troubleshooting

  • Still asked for a password. The server ignores the key file if the permissions are wrong. Log in with the password and run chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys again, and check the key is on one line with nothing added. Also confirm you are connecting with the site's username, not your Console email.

  • Permission denied (publickey). The private key you are using does not match a key on the site, or the username is wrong. Run ssh -v USERNAME@HOST to see which key your computer is offering.

  • Using PuTTY on Windows. Copy the key from PuTTYgen's Public key for pasting into OpenSSH authorized_keys file box. The saved .ppk or .pub file from PuTTYgen is in a different, multi-line format that the server will not accept.

  • Connection refused after several failed attempts. Repeated failed logins temporarily block your IP address. Wait a while before trying again, or contact us and we will lift the block.


Need help?

If you get stuck at any step, our support team is available 24/7 with a one-hour response time. Reach out from your dashboard.

Did this answer your question?