Using SFTP protocol to access file on your VPS with Filezilla client

Introduction

A big part of your work may be related to transferring files to/from your VPS server. There are different conventional methods of doing so, some of them are: SCP - secure copy protocol, using SSH as a transport protocol FTP - file transfer protocol. NFS -network file transfer protocol SFTP - SSH File Transfer Protocol

In this article i am going to tell you how to use SFTP protocol. You may ask why ? The answer is simple: both NFS and FTP, i have mentioned, require you to setup additional software on your VPS server, and require to perform additional steps to make your access secure. Usually we simply want to transfer files to/from our VPS server in an easy, fast and secure fashion. SFTP perfectly suits our needs, that is why i am going to focus on it. Many people wrongly say that it is FTP, working over SSH, which is in fact wrong. It is a new protocol, SSH v2.0 extension, which also may be used as a secure file transfer over TLS and some other applications. To use SFTP you need to ensure your VPS has ssh v2.0 enabled ( it is enabled on your VPS by default ) and you have a working client, that can establish SSH connection to your VPS. Basically if you can SSH to your VPS, SFTP is also working for you.

Prerequisites

1) Centos 7.4 VPS server ( guide works fine for other Linux systems, Centos was used for reference ) 2) Windows client machine, from which you will be accessing VPS 3) I highly recommend to follow this hardening guide[1] and generate key-based access to your VPS. Generally password-protected SFTP connections are supported by most clients ( filezilla included ), but it is much more secure to use a key-based authentication.

Choosing the client

There are several options, that you may use: WinSCP[2], putty sftp client (psftp )[3], smartftp[4], or FileZilla[5].

Filezilla[6] is fast, used by many people, has a user-friendly interface , so i am going to describe how to setup it to have a secure connection SFTP connection.

Setting up a secure setup

First of all by default you already can connect to your server out of the box, just run filezilla, enter your VPS server IP, login/password pair and port ( by default port is 22) You will immediately have access to your VPS over SFTP protocol. However, we really want it to be secure. There is an easy option to achieve it: follow this hardening guide[7] to generate a pair of keys to access your VPS and continure further.

Setting up Filezilla

Start Filezilla and press Edit -> Settings In the left menu, choose SFTP, press Add key and choose the private key you have generated by Putty tools. fzkey press File - Site Manager On the new Site Manage manu press new site and enter the desired name for it. In the right menu, on the general tab, enter your VPS server IP, port ( by default it is 22 ) and choose SFTP in the Protocol drop-down menu. fz3

Choose Interactive in Logon Type Menu and enter your user name, with which you access your VPS server, and have a key created. In most cases it will be root. fz4

After that you can press connect. In case your ssh key is password protected, you will be prompted to enter the password. fz5

There is no need to convert the key, like it was done with previous versions of Filezilla, or run some background tools. Next time you will want to connect to your server through filezilla, you need just start the tool, and choose your server in the dropdown Site Manager menu below the File button fz6

Just press on the name of your server and FileZilla will automatically connect to your VPS fz7

Filezilla also allows you to edit text file on your VPS server. To do so, navigate to the file in the FileZilla menu, right click and press View/Edit. First time Fileziila will ask you what text editor to use ( by default Windows Notepad is used ), next time it will open the file automatically with the last choice. It can also be changed in future, by using Edit - Settings - File Editing fz8

Conclusion

Now you know how to quickly upload and download files from VPS server, and even edit text files, if needed. Securing your SSH connection also allows you to setup a secure SFTP connection, so please always consider doing it

[1]: https://www.vpsserver.com/community/tutorials/edit/3917/
[2]: https://winscp.net/eng/docs/start
[3]: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
[4]: https://www.smartftp.com/en-us/
[5]: https://filezilla-project.org/client_features.php
[6]: https://filezilla-project.org/client_features.php
[7]: https://www.vpsserver.com/community/tutorials/edit/3917/