Windows doesn't have a built-in SFTP client. So if you're looking to transfer files with an SFTP server but are using a Windows machine, you might want to check out this post.
For this tutorial, we'll be using AnyClient, a platform-independent (meaning it runs on Windows, Linux, Mac OS X, Solaris, etc) file transfer client that supports SFTP as well as other file transfer protocols like FTP/S, SFTP, WebDAV/S, Amazon S3 and AFTP.
To start, download the appropriate installer.
You'll notice that AnyClient has installers for various operating systems. Two of these run on Windows. Since Windows comes in 32-bit and 64-bit versions, you'll need to download the installer that corresponds to the version you're using.
Once you've downloaded and launched the appropriate installer, you'll be faced with the AnyClient Setup Wizard. Click the Next button and follow the instructions shown thereafter.
As soon you complete the installation, leave the "Run AnyClient" checkbox checked and click the Finish button to automatically launch AnyClient.
Being an SFTP client, AnyClient is capable of transferring files over an encrypted channel. That means, it's suitable for uploading and downloading files that require high levels of confidentiality. Like other SFTP clients, AnyClient also supports the use of SFTP key authentication a.k.a. public key authentication.
In the succeeding sections, we'll show you how to use AnyClient to connect to an SFTP server, upload and download files, and login via public key authentication.
Ready? Let's proceed.
Connecting to a SFTP server
Once you've launched AnyClient, you'll be brought to the following screen (see screenshot below). Click the Connect/Sync button.
The first thing you'll need to do is set up a "site". A site holds all the necessary information you need to connect to your SFTP server. Follow these steps to create a site. You may use the screenshot below as a guide.
1. Click the New button. This will create a new item under the node labeled "Site Manager".
2. Rename that newly created item. I simply entered "sftp" but you might want to use something more descriptive, like "SFTP server of Company so and so".
3. Expand the Protocol drop-down list and select SFTP/SSH. Notice that there are other file transfer protocols on that list. That should give you an idea what other file transfer servers AnyClient can connect to.
4. Enter the Host name or IP address of the server you're connecting to. In our example, we're just connecting to a server installed on the same machine as the client, so we simply entered 'localhost'.
5. Enter the Username of the account you'll be using to access the SFTP server. Note that you'll need to have an existing account on the SFTP server before you can connect.
6. Enter the username's corresponding Password.
7. Once you're done entering the basic information, you may click the Connect button to see if you can actually connect. If everything's good, I suggest you click the Save button to save all the information you just entered. This will allow you to easily access the same service using the same user account in the future.
The first time you connect to the server, you'll be shown this dialog, which contains the fingerprint of the SFTP server's public key. The fingerprint uniquely identifies the SFTP server. Of course, the public key also uniquely identifies the server but it's usually very long. That's why its corresponding fingerprint is normally shown in its stead.
If you just click Accept, this dialog will reappear each time you connect. To prevent that from happening, click Accept and Save. Once you do that, your client will save the relevant information, i.e. IP address/hostname and the corresponding fingerprint.
The client will then use this information to verify the identity of the server every time it connects. If the server submits a fingerprint that doesn't match what was previously saved, the dialog will again reappear. This could mean one of three things:
1. The public key on the server was changed.
2. The client is connecting to a different server found in the same cluster as the one it previously connected to (e.g. when the two servers are behind the same load balancer, and hence are showing the same IP to the client but have different public keys)
3. The client is being subjected to a man-in-the-middle attack.
For security reasons, it's therefore important to check with the server's administrator if the dialog reappears even if you've been connecting to the same server (and have clicked Accept and Save) ever since.
Uploading and Downloading files
It's time to get into the meat of this tutorial. Let's now discuss how to upload and download files. Before we proceed with that, allow me to orient you first with the user interface. As soon as you've connected to the server, you'll be presented with the user interface shown below.
That huge panel on the left represents your local file system. There you'll see the files and folders on your laptop or desktop. That huge panel on the left, on the other hand, contains all the files and folders on your SFTP server. Depending on the SFTP server, the files and folders you'll see on the right may be limited to those where you have access rights for. Navigation is very similar to most graphical file managers. You just double-click a folder to navigate into it.
To upload a file, just do the following:
1. Navigate into the folder that contains the file you want to upload and then select the file by clicking it.
2. Navigate into the remote folder where you want to upload the file.
3. Click the right-pointing arrow below the "local" panel to upload.
If everything goes well, you should then see your newly uploaded file in the 'remote' panel.
The download process is similar to that. In the screenshot shown below, we have selected multiple files. You can use the same hot keys as your operating system's for selecting multiple files. So, basically, the download process consists of:
1. Navigating into the folder that contains the file(s) you want to download and then selecting the file(s) in question.
2. Navigating into the remote folder where you want to download the file.
3. Clicking the left-pointing arrow below the "remote" panel to upload.
Here's the screenshot showing the newly downloaded files.
AnyClient supports several other functions. These functions correspond to the numbered icons shown in the screenshot below:
1. Create a new folder
2. Rename the selected file or folder
3. Delete the selected file(s) or folder(s)
4. Refresh the folder
5. Resume an interrupted upload
6. Upload the selected file(s)
7. Zip the file before uploading
The same functions can likewise be found in the 'remote' system.
Using SFTP public key authentication
One of the major advantages of SFTP over FTP and other less secure file transfer protocols is its ability to provide two-factor authentication. SFTP provides 2F through what is known as public key authentication, a process that allows the server to authenticate the user based on something he/she has (specifically, a user's private key).
When used in conjunction with password-based authentication (which authenticates the client based on something the user knows), the server can authenticate with a much higher degree of certainty. If you're not familiar with 2 factor authentication and public key authentication, feel free to click the links in the previous paragraph.
In order to login via 2 factor authentication, navigate to the Options tab and then do the following:
1. Check both "Use password authentication" and "Use public key authentication".
2. Browse and select the user's private key.
3. Enter the private key's password/passphrase.
4. Click the Connect button.
Would you like to try this yourself? Download AnyClient now.