Connecting to SFTP for Shared Accounts

We recently added Secure FTP (SFTP) to our Shared plans. SFTP, different than FTP access, doesn’t use the normal cPanel login to access your account. Below is our guide on using FileZilla and connecting to SFTP for shared accounts.

Generate access keys via cPanel

The first step is creating your public and private keys. If you haven’t done this, you can find the instructions in the following article SSH access for Resellers and Shared Servers. If you already created keys for SSH access, you will use the same keys for SFTP.

Create the FileZilla profile

The next step is creating your SFTP profile in your FileZilla application. There are two steps in this process. First, you need to attach your private key file to FileZilla. Next, you need to create your connection profile.

NOTE: If you have converted the key to PPK format using cPanel make sure to review the PuTTy-User-Key-File version that it has been converted to. You will see it in the first line when you convert the key (as per the screenshot below). Some FTP clients are unable to use the PuTTy_user-Key-File-3 version. The version that is converted will vary based on the cPanel version that you are using. Build 94 and older will use the older formats (version 1 and 2). FileZilla is noted for not supporting version 3 of the PPK file. You can use another FTP client to avoid this issue.


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:
    FieldDescription
    HostEnter your domain name (ie: example.com) or server IP
    PortSet this to “2222”.
    ProtocolSet this to “SFTP – SSH File Transfer Protocol”.
    Logon TypeSet to “Ask for Password”.
    UserEnter your cPanel username.
    PasswordEnter your current cPanel password.
     
  4. Once all of the correct settings have been added, 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.

31 thoughts on “Connecting to SFTP for Shared Accounts

    1. Good question! The article is referring to SFTP on Shared Hosting accounts, so you will not be able to disable standard FTP on those. If you have a VPS or Dedicated Server, you can close the port or turn off the service.

  1. Thank you for writing instructions that are easy to read, understand and follow. Unfortunately, I am getting
    Error: Connection timed out after 20 seconds of inactivity
    Error: Could not connect to server
    Status: Disconnected from server
    Any suggestions?

  2. Hi, Using FileZilla
    I’m stuck in a loop. Keeps asking me to *Please enter a password for this server * I enter and the pop-up returns

  3. 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 “[email protected]” 2222
    Error: ssh_init: Host does not exist
    Error: Could not connect to server
    Status: Waiting to retry…

  4. 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.

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

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

    1. 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

  6. 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?

    1. 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.

    1. 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.

  7. 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!

  8. 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.

    1. 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

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X