Connecting to SFTP for Shared Accounts

While FTP access has always been allowed on our Shared plans, we have recently added the ability to use Secure FTP, or SFTP. This procedure is a little different and does not use the normal cPanel login procedure to access the account. Below is our guide on using FileZilla and connecting to SFTP for shared accounts.

Generate access keys via cPanel

If you have not already done so, create your public and private keys as per the instructions in the SSH access for Resellers and Shared Servers article. If you already have created keys for SSH access, the same keys will be used for SFTP.

Create the FileZilla profile

After your keys have been generated, you will need to create your SFTP profile in your FileZilla application. There are twos steps to this process. First you will need to attach your private keyfile to FileZilla and then you will need to create your connection profile.

Attach your private keyfile.

  1. Log into your FileZilla application.
  2. From the upper toolbar, click on Edit and then Settings.
  3. A settings popup will appear. From there click on SFTP in the left-hand toolbar. In the right panel, click on the Add keyfile… button.

  4. Using the popup window, navigate to the ppk file you saved for your private key and click Open.

  5. The keyfile will appear in the list. Click the OK button to save the information.

Set up the SFTP connection profile

  1. Using the upper toolbar, click on File and then Site Manager.
  2. A popup will appear for you to create a new profile. Click on the New Site.
  3. The right hand form will appear brighter, indicating you can now enter data in it. Be sure to enter data into the following fields:

    Field Description
    Host Enter your domain name (ie: example.com) or server IP
    Port Set this to “2222”.
    Protocol Set this to “SFTP – SSH File Transfer Protocol”.
    Logon Type Set to “Ask for Password”.
    User Enter your cPanel username.
    Password Enter your current cPanel password.
  4. Once all data has been entered, click Connect to let FileZilla connect to your server.

Once you have completed the above, you should be able to connect to your shared account using SFTP.

Thoughts on “Connecting to SFTP for Shared Accounts

  • I am using filezilla and getting following error. Can you please suggest what is that I am doing wrong. Status: Connecting to mydomain.com:2222…
    Response: fzSftp started, protocol_version=8
    Command: keyfile “C:\kdfsd\pkey.ppk”
    Command: open “user@mydomain.com” 2222
    Error: ssh_init: Host does not exist
    Error: Could not connect to server
    Status: Waiting to retry…

  • There’s a step missing here!

    Once you’ve generated a key, you must go back to the Manage Keys section, select Manage on the key you just generated, then AUTHORISE the key!  Otherwise, it will never work.

  • Hello, I’m using FileZilla on Ubuntu 16.04 and I keep getting this:

    Error: Disconnected: No supported authentication methods available (server sent: publickey)

    • Hello,

      It sounds like the key Filezilla is trying to authenticate with is incorrect, I would recommend making sure you have the correct key in the configuration, By default, it will use the one for the account you are logged in as.

      Best Regards,
      Kyle M

  • I noticed that if I enter a wrong password when filezilla ask for it the connection will still succeed. Is that something expected once the key setup has been done?

    I even modified my cpanel password, relaunch filezilla, and the connection will still succees whatever the password I enter.

     

    is that the expected behaviour?

    • Keys become the authentication method for logging in once they are set up. That’s why the password no longer matters. That’s the point of keys, so you dont need passwords.

    • Hello JB,

      When you create the account in cPanel, then you can limit what the FTP user can access based on the folder that you indicate in their settings. If you’re trying to isolate them to a specific folder, then that folder cannot be a parent folder to numerous other folders.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  • I was able to get this working in Coda 2, finally! I found that using the keys generated through cPanel was not possible in Coda, so I tried generating my own through Terminal like this:

    ssh-keygen

    Give it a unique name, like inmotionhosting and set your passphrase – just like you do through cPanel.

    After generating the key, add it to your Keychain with:

    ssh-add -K inmotionhosting (but replace ‘inmotionhosting’ with whatever you name your key)

    Once that’s done, head over to Security -> SSH Shell Access in cPanel and click Manage SSH Keys. Then click Import Key.

    Enter the name that you gave your key in the relevant field. Then copy and paste the contents of your private and public key files that you generated earlier in their respective boxes. Type in your passphrase where it asks for it.

    If you want to quickly view the contents of these key files in Terminal, use these commands (assuming you named your key ‘inmotionhosting’):

    cat ~/.ssh/inmotionhosting

    cat ~/.ssh/inmotionhosting.pub

    Copy and paste the results of those commands into the private field (first one) and then the public field (second one) in cPanel. Then click Import. Go back to the list of your keys and click Manage Authorization next to the key name you just imported, then click Authorize.

    Go back to Terminal on your Mac and create a new ‘config’ file in the ‘.ssh’ directory if there is not already one there. You can do this with nano like this:

    nano ~/.ssh/config

    In it, add a new host record that looks like this:

    Host YOURSERVERNAME.inmotionhosting.com

    HostName YOURSERVERNAME.inmotionhosting.com

    User YOURUSERNAME

    IdentityFile ~/.ssh/inmotionhosting

    Port 2222

    Then save the file with CTRL-X and hit Y to confirm, then Enter.

    Go back to edit your site within Coda, and go to the Server tab. Select SFTP under Protocol, then type in the name of your shared server in the Server field. Leave everything else blank. The config file that you just created will be pulled when attempting to connect and will use the details you entered above.

    By doing all of this, I am now able to successfully connect to my account via SFTP in Coda 2!

  • Hey there,

    I followed the steps to add the key to my mac’s keychain, then tried connecting with Coda, restarting coda after every step. It still doesn’t work: says that the login doesn’t authenticate.

    • Hello bennyp,

      Thank you for contacting us. An authentication error is usually related to username, and password. I recommend confirming your FTP Settings are correct and without misspellings.

      If your problems persist, I recommend checking the FTP logs for additional errors, or clues. If you are on a shared server, Live Support can help you with this.

      Thank you,
      John-Paul

Leave a Reply