Tuesday, January 24, 2017

FTP with Remote archive handling

Is FTP Enough ?

FTP is the way one usually goes when he wants to upload/download files to his server, but pure uploading and downloading is not enough, as there is a simple yet very important feature which is still absent and it is some archive handling.

When I say "Archive handling" I refer to packing and extracting files to/from an archive (eg: tar or zip file).

Why Archive handling

Because transferring many files (thousands) to/from my server is very very slow, so when I want to start a new site and upload all files for my wordpress site, I prefer uploading a single zip file (less than one minute) then extracting it remotely on my server which will take several seconds, rather than upload thousands of files which might take several hours (assuming nothing fails in the way). (same goes for backing up my site, where zipping the whole site then downloading a single file is much preferred over downloading all files from the server)

The usual way I did it in the past was to upload my zip file to the server, then access it from my CPanel, where I had a "file manager" which had a nice feature of unzipping any archive.

Another popular way is after uploading the file, to access the server via shell and unzip the archive using simple unix commands.

What can I do when I have no Shell access and no FileManager ?

I have now a nice and new VPS, which means that I control the server, and since I don't want to pay for a CPanel license, I have found a free alternative which is VestaCP.

VestaCP is a great panel for a unix system, the only downside is that it doesn't have a file manager, well actually it has one but it must be purchased (about 50$ for a lifetime license), so I went searching for an alternative.

I was sure it will be a simple task, since there are several file managers in use of different unix panels (like the CPanel and VestaCP file managers), I assumed that these file managers are standalone components which the panel developers have customized to be built into their panels - well, I was wrong!

It seems that these file managers were produced and are maintained by the unix panel developers, which sounds dumb to me as I don't think that a unix panel developer should develop the components in the panel as I assume they will be done better when they will be separated and someone will take the time to give each component it's full attention.

Free File Managers

Anyway, while searching for an actively maintained and nice file manager which also supports archive management I found many out of date file managers, several commercial ones but also several free ones.

To name a few:
  • Sprut.io
  • elfinder
  • Net2Ftp
But I wasn't satisfied, the above file managers will be able to do the job, but that means adding an additional component to my server which is bad for performance, but more importantly, it is bad for security as when I install a file manager I am actively opening another opening into my server (which already has open ports to allow apache, sftp etc).

And then suddenly it striked me, i don't need a server side archive unpacker as I can use a client side with remote archive handling.

I am a long time filezilla fan, that is why this solution occurred to me only after lots of reasearch as filezilla sticks to the FTP protocol and doesn't allow archive handling which doesn't exist in the FTP protocol.


But there are other good ftp clients out there, so before I almost broke and bought a commercial ftp client with that capability I stumbled upon WinSCP.

Winscp is a long time filezilla competitor, and although I tried it in the past I decided to go over to filezilla as I found filezilla more robust and faster in file transfer speeds.
But winscp has a feature filezilla lacks and will probably never have, which is remote script execution, which means that you can write a script (unix command line) in the client, then ask winscp to run it on the server.

problem solved!
Winscp has several built in scripts, one of which is server side packing/unpacking.

Which means that I have gained the server side packing/unpacking without installing any additional components on my server thus not burdening it with an additional component neither exposing it to security risks.

No comments: