Connecting via SFTP + SSH Keys

This tutorial covers Windows, Mac OS X, and Linux.

Both FTPS and SFTP offer the ability to transfer files through a secure, encrypted connection. The difference however is that while FTPS uses SSL and is fairly ‘hands-off’, SFTP uses an SSH connection which requires a special public/private key pair that you will need to generate on your local computer.

When you generate a key pair, there will be two halves to it, a public half and a private half.

The private half must never be shared, and will always remain on your local computer. The public half of the key goes on the host machine you’re trying to connect to. You can email it, paste it publicly online and so on.

Important: It’s very important you don’t share your private key. One common mistake people make is that if they want to give access to another person to connect to the same host, they just email them their personal private key. This is the wrong way to do it, instead, that other person should generate their own public/private key pair, and then add that new public key to the host.

Once you’ve generated your key pair, and have added the public key to your Files.com account, you simply need to look at your FTP client and find where you can choose the location of the private key on your hard drive.

Windows

This guide requires you to use the PUTTYgen (free) open-source application. PUTTYgen is a standalone application that does not require you to install it. You can download a copy of this utility from the maintainer’s website.

Generating compatible keys with PUTTYgen

1) Open the PUTTYgen application by double clicking on it.

2) Choose ED25519 for the Type of key to generate

3) Click the Generate button

4) Move your mouse around until the progress bar is full.

5) You now will have a generated public and private key.

6) Save the private and public key files to a location that only you can access and that you will not lose.

7) Right click in the text field labeled Public key for pasting into OpenSSH authorized_keys file and choose Select All

8) Right click again and choose Copy

9) Finally you need to add the SFTP public key to your Files.com account. Navigate to Settings > Users and click the the username of the appropriate user. Click the SFTP Keys setting, and paste the contents of your clipboard into the Public Key text area. For the Title you can enter any piece of identifying information that you want (for example, my laptop).

Mac OS X

Mac OS X already includes the necessary software to generate a key pair. Simply click the magnifying in the top right hand of your screen, type in Terminal and hit enter to open the application.

1) Create the new ED25519 Key

ssh-keygen -t ed25519

2) When prompted specify the path you want to save the key files in.

Enter file in which to save the key (/home/user/.ssh/id_ed25519):

3) If you wish to enter a passphrase for the private key you can enter it when prompted. A passphrase is not required for the private key though. If you do enter a passphrase you will have to type it in each time you use the private key.

Enter passphrase (empty for no passphrase):

4) Now that your key is generated you will want to copy it to your clipboard so that you can add it to your SFTP Keys.

pbcopy < ~/.ssh/id_ed25519.pub

5) Finally you need to add the SFTP public key to your Files.com account. Navigate to Settings > Users and click the the username of the appropriate user. Click the SFTP Keys setting, and paste the contents of your clipboard into the Public Key text area. For the Title you can enter any piece of identifying information that you want (for example, my laptop).

Linux

Linux already includes the necessary software to generate a key pair. Simply open your bash shell and type the following commands.

1) Create the new ED25519 Key

ssh-keygen -t ed25519

2) When prompted specify the path you want to save the key files in.

Enter file in which to save the key (/home/user/.ssh/id_ed25519):

3) If you wish to enter a passphrase for the private key you can enter it when prompted. A passphrase is not required for the private key though. If you do enter a passphrase you will have to type it in each time you use the private key.

Enter passphrase (empty for no passphrase):

4) Now that your key is generated you will want to copy it to your clipboard so that you can add it to your SFTP Keys.

xclip -sel clip < ~/.ssh/id_ed25519.pub

5) Finally you need to add the SFTP public key to your Files.com account. Navigate to Settings > Users and click the the username of the appropriate user. Click the SFTP Keys setting, and paste the contents of your clipboard into the Public Key text area. For the Title you can enter any piece of identifying information that you want (for example, my laptop).