SFTP is an alternative to the old, insecure FTP protocol and allows you to upload files to your Pagely account with ease.
In this article, we'll show you how to generate SSH keys for authentication and connect them to your Pagely account for fast, secure access to your site's files.
Step-By-Step Walkthrough (Recommended)
Are connecting from a Mac or Windows computer?
I'm using a Mac I'm using Windows
If you're on a legacy shared hosting account, start here.
Note: These instructions apply to all VPS and Enterprise level hosting when using Pagely's Atomic control panel. If you're on an older legacy account with the older control panel, you'll want to take a look at the section later in this article on accessing SFTP for legacy shared hosting accounts.
Checking For Existing SSH Keys
Before generating a new SSH key pair, you'll first want to make sure you don't have any existing SSH keys to use (or potentially overwrite!). Here's how to check for an existing SSH key:
Mac/Linux
To search for an existing SSH key, open up a Terminal window and run the following command:
ls ~/.ssh | grep pub
This command will allow you to see all public keys that are present in your account. If an SSH key already exists, you'll see a file ending in .pub, most commonly named id_rsa.pub.
If you DO find an SSH key, skip to the section on getting your SSH key.
If you DO NOT see an SSH key listed, follow the next section to generate a new SSH key pair.
Windows
First, we need to check to see if you already have an existing SSH key present. Open up a Command Prompt window and run the following command:
dir %userprofile%/.ssh
This command will list any SSH keys that are present on your user profile. If an SSH key exists, you'll see a file listed that ends with .pub, usually id_rsa.pub.
If you DO find an SSH key, skip to the section on getting your SSH key.
If you DO NOT see an SSH key listed, follow the next section on generating a new SSH key pair.
Generating a New SSH Key Pair
This section covers the process of generating an SSH key pair for securely connecting to your hosting account. An SSH key pair consists of a public key that will be uploaded to the server, and a private key on your computer to match it.
If you already have an SSH key pair that you want to use, you can go ahead and skip this section.
Note: Be sure that you don't have an existing SSH key present. If you do, you'll want to back it up first to avoid possibly losing it.
To generate a new SSH key pair, open a terminal window (Command Prompt if in Windows) and enter the following command:
ssh-keygen -t rsa -C "YOUREMAIL@example.com"
Windows Users: If this command gives you an error that the command is not found, you may need to install ssh-keygen via Git For Windows. Alternatively, you can also generate a key pair with a GUI such as PuTTYgen.
When running that command, it'll walk you through the process of creating a new SSH key pair. Once complete, continue on to the next step on getting your SSH key.
Getting Your SSH Public Key
Mac
Open a Terminal window and enter the following:
Note: The following command assumes that your public key is named id_rsa.pub. If your key is named something different, you'll need to replace it in the command with the correct file name.
pbcopy < ~/.ssh/id_rsa.pub
Your SSH public key has now been copied to the clipboard. You're ready to continue with adding your SSH key to your Pagely account.
Windows
Open a Command Prompt window and enter the following:
Note: The following command assumes that your public key is named id_rsa.pub. If your key is named something different, you'll need to replace it in the command with the correct file name.
clip < %userprofile%/.ssh/id_rsa.pub
Your SSH public key has now been copied to the clipboard. You're ready to continue with adding your SSH key to your Pagely account.
Linux
Open a new terminal window and enter the following command to display your public key:
cat ~/.ssh/id_rsa.pub
Then, just copy the contents of the file that are output. You're ready to continue with adding your SSH key to your Pagely account.
Creating an SSH User and Uploading a Public Key
Once you have your SSH key, adding it to Pagely's Atomic control panel is easy. Here's how to do it:
- Begin by logging into your Pagely account.
- Next, visit your Account Settings page by clicking on the menu item at the left side of the page.
- From within your account settings, click on the button labeled SSH to go to your SSH settings.
- Inside the SSH Username field, enter the username that you want to use, then select Create Username. This will be automatically prefixed with client_, so if you entered jeff, your username would become client_jeff.
- Remember that public key that you got earlier in this article? It's time to use it. Inside the text box labeled Add a Public Key, paste the contents of your public key. Alternatively, you can also upload your public key using the file upload button and browsing for your public key (public key file names will end in .pub).
- Once your public key has been set, be sure to click the Add Public Key button to upload it.
You're all set! You'll now be able to log in via SFTP using your username (don't forget the client_ prefix!) and your SSH key pair.
Note: Be sure not to lose your private key that's stored locally on your computer. Without it, you won't be able to authenticate with your public key!
Connecting Over SFTP
Depending on the SFTP client you're using, the specific settings will vary a bit. Generally, you'll want to set these settings:
Host: The IP or hostname for your app.
Username: The username you set when adding your key, prefixed by client_.
Password: Leave this blank, but look for a key icon near the field. That's where you'll add your SSH key. In some clients such as Transmit for Mac, it will automatically look for your keys in the default locations.
Port: 22
Protocol: SFTP
For example, a configuration in Transmit would look something like this:
Legacy Shared Hosting
If you're on a legacy shared hosting account, you will need to access your account with a username and password instead of the more secure method of using an SSH key that was mentioned above. Here's how to enable SFTP and gain access:
Please note: Only the Primary Administrator can enable SFTP at this time.
- Begin by logging into your legacy shared hosting account.
- Once inside your control panel, click on Apps to view a list of the sites on your account.
- Click on the app in question.
- Click on the SFTP tab in the application window.
- You should now see an Enable SFTP button which will add SFTP credentials to this page once enabled.
Using SFTP With Legacy Accounts
Most SFTP clients will work just fine with the default settings. If you don't already have a preferred SFTP client, here's a few to try:
Of course, if you need any help configuring your particular SFTP client let us know! Our support team is happy to help!