To authenticate successfully, your server needs a copy of your public key. (Important: Never share or upload your private key.)
Option A: The Automated Way (Mac / Linux)
If you are on macOS or Linux, you can automatically create the required directories, set the strict security permissions, and upload your key in a single command.
Open your terminal and run the following (enter your FTP password when prompted):
ssh-copy-id -s -p 2222 -i ~/.ssh/id_ed25519.pub [your-ftp-username]@[your-domain.com]
(If this succeeds, you can skip directly to Step 3. If it fails due to server restrictions, use Option B).
Option B: The Manual Command Line (Windows / Fallback)
Windows users, or users whose accounts are restricted strictly to SFTP, will need to create the security folders manually using the interactive SFTP prompt.
- Open your terminal, navigate to your hidden ssh folder, and connect to your server (ebter your FTP password when prompted):
cd ~/.sshsftp -P 2222 [your-ftp-username]@[your-domain.com]
- Once connected, your prompt will change to
sftp>. Run the following commands one by one exactly as shown below:sftp> mkdir .sshsftp> chmod 700 .sshsftp> cd .sshsftp> put id_ed25519.pub authorized_keyssftp> chmod 600 authorized_keyssftp> exit
Option C: Using FileZilla (Visual Interface)
If you prefer a visual interface, you can create the directory and upload your key manually using FileZilla:
- Connect to your server via SFTP in FileZilla using your current username and password.
- In the Remote site window (the right side), right-click on an empty space and select Create directory. Name it exactly
.ssh and click OK.
- Press Right-click the new .ssh folder and select File permissions…. Enter 700 in the numeric value box and click OK.
- Double-click the
.ssh folder to enter it.
- On your local computer (the left side), locate your public key file (
id_ed25519.pub). Right-click it and select Upload.
- Once uploaded to the
.ssh folder on the server, right-click the file, select Rename, and change its name to exactlyauthorized_keys.
- Right-click the
authorized_keys file, select File permissions…, enter 600 in the numeric value box, and click OK.