FileZilla Server: Portable FileZilla FTPd

From The Uniform Server Wiki
Revision as of 19:05, 11 October 2008 by Ric (talk | contribs) (New page: {{Uc nav FileZilla Server}} '''Uniform Server and portable FileZilla Server''' The previous pages covered a general portable version of the FileZilla Server strictly speaking not truly po...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MPG UniCenter

MPG UniCenter

Uniform Server 3.5-Apollo
FileZilla Server.

Uniform Server and portable FileZilla Server

The previous pages covered a general portable version of the FileZilla Server strictly speaking not truly portable because of absolute paths used on a host machine.

This page looks at final tweaks required to make the server truly portable. My definition of portability the FTP server shall shadow Uniform Server, and have the capability of transferring data to any folder within the web-root folder www.

Initial test configuration

The FTP server requires reconfiguring to run on the virtual drive created by Uniform Server. All that is required is to re-map the location of the server certificate and to set the home folder to server root folder www.

  1. Start Uniform server Server_Start.bat
  2. Start the server by double clicking on filezila_start.bat
  3. Start the administration interface, double click on filezilla_admin.bat
  4. Select Edit > Settings
  5. Select SSL/TLS settings (left menu)
  6. Use Browse to select path to Private key file (w:\filezilla_server\certificate.crt)
  7. Use Browse to select path to Certificate file (w:\filezilla_server\certificate.crt)
  8. Click OK

Note: The path must be the virtual drive.

  1. Select Edit > Users
  2. Select Shared folders (left menu)
  3. For user fred select the home folder and delete.
  4. Click Add and navigate to the root folder w:\www
  5. Make sure it is marked with “H” if not click Set as home
  6. Click OK

This updates the configuration file \Uniform Server\udrive\filezilla_server\FileZilla Server.xml

Open this file and you will find these three lines:

<Item name="SSL Key file" type="string">w:\filezilla_server\certificate.crt</Item>
<Item name="SSL Certificate file" type="string">w:\filezilla_server\certificate.crt</Item>
<Permission Dir="w:\www">

These three lines prevent the server being portable should a user start Uniform Server with a different drive letter the FTP server will fail.

Top

Solution

The solution is to run a small script that changes the drive letter when Uniform Server is run. The variable %Drive% (in Server_Start.bat) contains a users selected drive. This is passed to a Perl script that replaces the old drive letter with the new one.

Top

Implementation

I always use a batch file to hammer a peg in the ground (defines the current working directory and saves return path to caller) from this reference run the Perl script.

Create the following two files and save in folder \Uniform Server\udrive\filezilla_server:

Top

change_drive_letter.bat

pushd %~dp0
..\usr\bin\perl change_drive.pl %1
popd

First line save return path and sets working directory to current folder.

Execute Perl interpreter (relative to current folder) pass it the script name and drive letter %1 passed to this batch file.

Reinstate the return-path and return to calling program (Server_Start.bat)

Top

change_drive.pl

#--- Get parameter passed to this script
my $new_drive_letter = $ARGV[0];

#--- Read file to array
  open FILE,"<FileZilla Server.xml" or die $!;
  @lines=<FILE>;
  close (FILE);

#--- Search for *:\ and replace with $new_drive_letter:\

foreach (@lines) {
  $_ =~ s/.:\\/$new_drive_letter:\\/g;
}

#--- Write array to file
  open FILE,">FileZilla Server.xml" or die $!;
  print FILE @lines;
  close (FILE);

exit;
  • The parameter (drive letter) passed to the script is strored in variable new_drive_letter
  • The file FileZilla Server.xml is read line by line and stored in array lines.
  • This array is scanned line by line.
  • Each line is searched for the string .:\\ and replaced with $new_drive_letter:\\
    Note: .:\\ The full-stop is a wild card in Perl and matches any character.
    A single back-slash is a special format character hence two are required to negate its effect.
  • The entire array is written to file FileZilla Server.xml over writing its content.

Top

Folder Uniform Server

With so many different start and stop files the folder Uniform Server quickly becomes cluttered hence I tend to delete all unused files. To reduce these further there is no need to have separate start and stop files for FileZilla server they can be integrated with Uniform Server’s batch files.

To avoid confusion the download will add two new files named New_server_start.bat and New_stop.bat either modify the originals as shown below or delete the originals and rename the the new files Server_Start.bat and Stop.bat respectively. File filezilla_admin.bat remains to provide independent control of the interface.

Top

New_server_start.bat (Server_Start.bat)

Modification to New_server_start.bat requires the addition of two lines as shown:

set closeit=%programit%close.bat %Disk%

:### New for FileZilla Server ##################################
CALL udrive\filezilla_server\change_drive_letter.bat %Disk%
CALL udrive\filezilla_server\filezilla_start.bat
:###############################################################

%Disk%:

Top

New_stop.bat (Stop.bat)

Modification to New_stop.bat requires the addition of a single line as shown:

@echo off

:### New for FileZilla Server##################
CALL udrive\filezilla_server\filezilla_stop.bat
:##############################################

udrive\home\admin\program\pskill.exe Apache.exe c

Top

filezilla_admin.bat

This file remains unchanged shown for completeness:

udrive\filezilla_server\filezilla_admin.bat

That completes the portable plugin, all that remains is to test it.

Top

Testing

You have three options either use your preferred client or use FireFTP covered on this page or use the Fillzila Client.

Fillzila Client

If you are not already running the FileZilla client why not download FileZilla Portable from PortableApps.com it complements our portable FileZilla server.

After downloading there is no configuration it works straight out of the box.

Run FileZilla client. In the Qickconnect boxes type:

  • Host: localhost
  • Username: fred
  • Password: fred123
  • Port: 990
  • Click Qickconnect button

An Unknown certificate pop-up is displayed. I do know this,
it is the default certificate downloaded with the plugin, click OK.

Note 1:

Note the detail provided in the certificate.

Unit: Is pertinent DO create a new certificate.

Note 2:

Take another look at the Quickconnect bar!

In particular Host: and Port:

Top

Download

Download the following file filezilla_server_plugin.exe from the Download and support page. Save it to folder Uniform Server.

Double click to extract the files no need to change the path. Once extracted if you wish to save space, delete file filezilla_server_plugin.exe

Top

Conclusion

The projected just covered started life when I required a secure FTP sever to run on a wireless network, installation method and program was of little importance. I tried FileZilla FTPd and discovered it served the purpose admirably. After looking at several files discovered it was inherently portable.

I could not resist the temptation to convert it into a portable version for Uniform Server. FileZilla FTPd like SlimFTPd is easy to use however it has one significant advantage, built in encryption and automatic certificate generation. This alone gave the inspiration to produce a working plugin. To a certain extent achieved my goal however it does not work straight out of the box, minor modifications are required.

Although operation over the Internet was not a requirement I decided to tackle this and provide detailed information and a default configuration that would serve as a starting point.

The plugin may require a few refinements but essentially it is a working design. Portable FileZilla FTPd plugin along with the FileZilla client make an excellent solution for transferring secure FTP data.

Top


Ric