This article will explain how to connect to a server using your private key over sftp in order to send and receive files to and from the server.
Prerequisites:
There are numerous FTP clients available, and many of them support SFTP. Greens247 recommends FileZilla, a free program that you can download here. FileZilla runs on Microsoft Windows, Apple Mac OS X, and Linux.
Procedures to SFTP to the server using a private key:
The following procedure shows how to configure FileZilla to connect to an account using a private key and SFTP. If you want to use a different FTP client, make sure that it supports SFTP and public key authentication.
To configure FileZilla to use a private key for SFTP access, follow these steps:
- Transfer the private key file to the client computer.
- Download FileZilla and install it on the client computer.
- Start FileZilla.
- On the Edit menu, click Settings. The Settings dialog appears.
- Under Select Page, click Connection, and then click SFTP. A list of currently installed private keys appears.
- Click Add keyfile.
- Browse to the location where you stored the private key file in step 1, and then click Open. FileZilla adds the private key.
If you used Linux or Mac OS X to generate the key pair, FileZilla may display a message that it needs to convert the key file. If this occurs, click Yes to have FileZilla convert the key file into a supported format.
- Under Select Page, click Interface.
- Under Behaviour, clear the Do not save passwords check box.
- Click OK.
- On the File menu, click Site Manager. The Site Manager dialog appears.
- Click New Site, type a name for the site, and then press ENTER.
- In the Host text box, type your site's domain name or IP address.
- In the Port text box, type 22.
The default port for SFTP is 22. However, Greens247 may use a different port for security reasons, depending on the service. If a different port was given to you by Greens247 then replace the default port with the one that was given to you.
- In the Protocol list box, select SFTP - SSH File Transfer Protocol.
- In the Logon Type list box, select Normal.
- In the User text box, type your server username.
- Leave the Password text box blank.
- Click Connect. After a few seconds, FileZilla establishes a connection to the server.
FileZilla may display a message that the server's host key is unknown. To trust the server permanently, select the Always trust this host, add this key to the cache check box, and then click OK.
Watch on the video guide on Youtube
How to connect to a SFTP with Key File, Video #78
Congratulation, you have successfully connected to your server over SFTP using your private key.
Last update: May 19th, 2020