When I discussed setting up your own VPN server, we had an issue how to transfer client files from the cloud server to the client. If you are using local physical server, it is not a problem to just use USB drive and copy files there. However, you do not get this possibility, when you have no idea where your physical server might even be.
Sending such confidential document with email is not good idea, as email is not really secure way of sharing data. Hillary Clinton learned it hard way. FTP is even worse idea than email, as password to your FTP account is sent in plain text, so are the files. You can set up HTTP server, get a free SSL certificate from Let’s Encrypt and create a secure download page for your files. That is secure enough, but would not that be an overkill? For you, preparing that, and for your (possibly) tiny VPN server where you need to set up another role of web server?
Given all that, have you not dreamt of a protocol that will allow you to easily send files, as easily as FTP but with better security layer? If you have, you do not have to any more! Such technology exists! It is called SFTP.
“S” in SFTP does not stand for “secure” actually, but for “SSH”. SSH means “secure shell”. SSH was designed to provide secure access to remote servers running Unix-like systems. It uses strong encryption providing sufficient level of security. SFTP is pretty much FTP over SSH protocol. The simplicity of use known from FTP is enhanced with the security layer provided by SSH.
How to install SFTP server?
Many Linux-based servers already have SFTP server installed. However, if this is not the case, launch terminal and install openssh-sftp-client (name might slightly differ per distributino) using your favourite package manager. As soon as the package installs, you are good to go!
Setting up SFTP server on Windows is a bit more complicated, but was nicely presented in this article.
How to access my files?
You need to login to the SFTP server. On a Unix-like system or Linux shell available via Windows Subsystem for Linux, open terminal, navigate to the folder where you want to download files, or from which you want to upload files to the server. Then type in:
Replace “username” with your username on that server and “serveraddress.com” with the address of the server. If connection is successful, you will be prompted for password. When connecting to the server for the first time, you will be also asked to verify the server fingerprint. This way your client enforces mechanism to prevent you from connecting to fake SFTP servers.
If connection and authentication succeeded, you should log in to a kind of a shell and be able to type commands. Commands do not differ much from regular bash commands. In the table below, you can find most important:
|pwd||print (i.e. display) working directory|
|put filename||send file “filename” from the local computer to the server|
|get filename||download “filename” file from the server to the current directory on your local computer|
|bye||end SFTP session|
As you can see, console interface is pretty straightforward, but you can look around for plenty of GUI applications. From those, I highly recommend SFTP plugin for Total Commander (also works well with open source Double Commander).
I wish you happy getting and putting!
Featured image from: https://davidpapp.com/wp-content/uploads/2011/01/transfer-files-to-new-computer.jpg
Also published on Medium.