Publishing over SFTP with an SSH key
An advanced method: create a key pair, register it with your web host and choose it in TOWeb.
An advanced method
Over SFTP, TOWeb usually connects with your hosting password. If your web host accepts it, it can also connect with an SSH key: a file kept on your computer that replaces the password. This method is mainly useful if you already have keys, or if your web host requires them. The password remains available, and it remains the right choice in most cases.
Before choosing the key
- The key stays on this computer. Someone you entrust the site to, a webmaster for example, will not be able to publish it with this key. Give them password access instead.
- To publish from another computer, copy the key to it, or create a new one and register it with your web host as well.
- If the key is lost, TOWeb can no longer publish with this method. Switch back to the password, or create a new key.
Creating the key pair
A key pair is made of a private key, which stays with you, and a public key, which you give to your web host. On a Mac, open Terminal. On Windows 10 or 11, open PowerShell. Then type this command and press Enter:
1ssh-keygen -t ed25519
Accept the suggested location with Enter. Then choose a passphrase, or leave it empty. Two files are created in the .ssh folder of your home folder: id_ed25519, the private key, and id_ed25519.pub, the public key. If an id_ed25519 file already exists, answer n: you already have a key, so use it.
With PuTTYgen, export the private key in OpenSSH format, from the Conversions › Export OpenSSH key menu: TOWeb does not read .ppk files.
Registering the public key with your web host
Open the id_ed25519.pub file in a text editor and copy its content: a single line that starts with ssh-ed25519. Paste it into your web host’s customer area, in the SSH keys section, whose name varies from one host to another. Without such a section, add this line to the .ssh/authorized_keys file of your hosting account, or ask your web host to do it.
Never give out the id_ed25519 file, without .pub: it is the private key.
Setting up TOWeb
- Open Publish and choose SFTP in Method.
- In Authentication, choose SSH Key.
- In Private key path, click Choose… and select the private key, id_ed25519 without .pub. You can also type its path, for example ~/.ssh/id_ed25519.
- If the key has a passphrase, type it in Passphrase (if the key has one). It is saved encrypted on your computer.
- Click Test Connection.
If the connection fails, the message gives the cause: key not found at that location, passphrase missing or wrong, or a file that is not a recognised key. With a key, TOWeb never tries the password instead.
To go back to the password, choose Password in Authentication.