SFTP Authentication with SSH keys

Automatic authentication using SSH keys can be set up from a Mac OS / Linux computer easily. In this article we’ll show how to convert your SSH key to a SFTP format for use with your (S)FTP client.

Time needed: 5 minutes.

Be aware, the SFTP format and SSH format is different. Step 2 is therefore necessary to make your SFTP client authenticate using keys. 

  1. Create .sftp folder

    First you have to log in to your Bolt either with SSH or SFTP.
    Here you’ll have to make a folder in the site root directory named .sftp.

    With SSH you can create that with this command: mkdir ~/.sftp
    With a SFTP client you should be able to right click in the site root folder with the option to create directory

  2. Generate SSH Key

    Back at your local machine, run the following command to create a properly SFTP formatted SSH key: ssh-keygen -e -f ~/.ssh/id_rsa.pub.

    Does your machine not come with a SSH key already, you’ll have to make it first. Run this command and enter through the prompts: ssh-keygen

  3. Save and upload key

    Save the output of this as the file name authorized_keys, and upload it to the .sftp/ folder on the server.

    With SSH you can do this with this command: scp path/to/authorized_keys [email protected]:~/.sftp
    With SFTP you should simply be able to drag and drop the file in the right place

  4. Connect to server

    After this, your (S)FTP client should automatically connect to the server using that key without needing your SFTP/SSH password

Should you have any questions, please contact our support chat at servebolt.com.

Give us your feedback on this article