FTP Tutorial

This FTP tutorial is aimed at new users all examples are run on SlimFTPd (V3.181) a fully functioning FTP server. You can download the server and examples see install section for details.

The tutorial has two aims first is to introduce you to SlimFTPd independent of Uniform Server hence is run from a separate folder on C drive (either as a standard program or service). The second aim to gain enough experience with SlimFTPd’s configuration file allowing you to confidently configure the one used in Uniform Servers plug in.

Security

The reason for using an FTP server is to serve files over the Internet any FTP server has this capability. Files may be either served or uploaded to any location on your file system (hard drives or even USB sticks). Having this capability is a serious security risk, you must ensure your FTP server’s configuration (file) only allows access to public areas.

SlimFTPd is a real server having the above capabilities for this reason support files (you can download) for this tutorial only allow the server access to folder uc_slimftpd_tutorial and all its sub-folders. While experimenting with configuration settings do not have your PC connected to the Internet all testing shall be performed locally.

The above is intended to scare you! However once you have tested locally and happy with your configuration settings by all means pop the server on line. With that out of the way you will be surprised how easy the server is to configure and test.

Top

Install Server and associated test files

To follow this tutorial extract SlimFTP and test files to your C drive using the following instructions.

  • Create a folder on C drive named uc_slimftpd_tutorial
  • Download the file uc_slimftpd_tutorial.exe (266KB MD5=3eed932f281ac95617feef82b0a276c8)
  • Save to above folder check the MD5 signature to make sure it was downloaded with no errors or been tampered with.


Note 1: The file uc_slimftpd_tutorial.exe is a single self-extracting archive.

Note 2: The MD5 was produced using winMd5Sum Portable - obtainable from Portable Apps.

Note 3: Like Uniform Server it does not use the registry hence there are no true install or uninstall files, to uninstall just delete the files.

Extract support files

Double click on uc_slimftpd_tutorial.exe this starts the extraction process. No need to change the folder destination, just click extract to complete.

Refer to the image below for files and folders you will see after the extraction process: (Note You can delete the archive file to save disk space)

Top level folder uc_slimftpd_tutorial
Sub level folder: dave, john and original are included to provide working folders you can navigate during the tutorial. Original contains SlimFTPd as download from WhiteSoft Development.
Program files: ServiceTool.exe: Allows you to install the FTP server as a service its a toggle action file that also allows you to uninstall the service.

SlimFTPd.exe: The FTP server program

SlimFTPd.log: This file is created when the server is run. (Not included in the download)

slimftpd.conf: This contained the server configuration covered in detail in this tutorial

Support files: uc_kill_process.bat: A single line batch file to start the service, just saves using a command prompt.

uc_start_service.bat: A single line batch file to start the service, just saves using a command prompt.

uc_stop_service.bat: A single line batch file to stop the service, again saves using a command prompt.

uc_stop_uninstall_service.bat: A two line batch file to first stop the service and then uninstall it.

Sub level folder: uc_tskill: Contains Uniform Server's kill process program

 

Top

Test

Testing is straight forward:

Browser test:

  1. Double click on file SlimFTPd.exe wait until the following file is created SlimFTPd.log
    (If it fails to start see Problems Section Wont Start)
  2. You may be challenged by your firewall allow connection on all ports.
  3. Type the following into your browser address bar: ftp://localhost/
  4. A pop-up will display: Authentication Required type the following:
  • User Name: ric
  • Password: unicenter
  1. The following results are expected:

Expected Result:

  1. Page displayed will be similar to the image on the right
  2. Click on the "Up to higher level directory" link
    If it does take you up one level you have serious security problems and an error in the configuration file.
  3. Click on folder "original" this will take you down one level
  4. Click on folder "slimftpd" again this will take you down one level.
  5. Click on the "Up to higher level directory" link this will take you up one level. Repeat, the last level will be that shown on the right.
 

Top

Test on-line

Note: Failing the expected result 2) you will be exposing all of C drive, until you have resolved the problem do not continue. I do not expect that to happen since you will have not changed the configuration file.

To put the FTP server on-line just connect to the Internet, that’s it. All that remains is to test if it can be accessed. Type the following into your browser ftp://your_domain_name.com/ use your real domain, your browser will display the page as above.


No domain name, that’s not a problem use your IP address instead. Not sure what it is! Then use an on-line resource to find it, for example WhatsMyIp displays your IP address top right of page.

Type that into your browser address bar for example: ftp://88.007.007.137/ use the real IP you found. Your browser will display the page as above.

If your browser cannot connect and reports a message similar to "The connection has timed out" or "Internet Explorer cannot display the webpage" chances are port 21 is being blocked to resolve see Problems Section Router below.

Top

Problems

The above really is that easy, however there is always something that throws a spanner in the works. These spanners come in four maddening forms.

Wont Start

After double clicking SlimFTPd.exe you receive a message "application incorrectly configured" or when trying to run as a service you receive "error 4001" it is not the configuration file that's a problem it's due to a lack of runtime components C++ 2005.

Use this links to download the required C++ 2005 Redistributable Package

Background: Recently I had a hard disk failure after Installing XP-Home SP2 and SlimFTP on the new drive my ftp server failed to work. I remembered this post on the forum I now understand its full implication. Thanks Mr X you were spot on, previously I must have installed an application that install these components by default hence why I never experienced any problems.

Antivirus Programs

This is a quick one to detect however it is more difficult to resolve. After a virus scan you find SlimFTPd.exe has been blown away (deleted) your virus checker was callous and deleted it without your permission. Check your virus manufactures web site for a resolution. I use Avast with no problems however in the past a friend had problems with Norton I have included this for reference:

Norton AntiVirus is draconian and automatically deletes SlimFTP.
This section applies to Norton Internet Security and Norton SystemWorks 2005
both with default settings.

To prevent Norton AntiVirus deleting files you need to add their names to two exclusion
lists. Doing this prevents the files ever being scanned hence no detection and no deletion.

Current SourceForge download file is SlimFTPd_3.16.exe
Extracted file name: SlimFTPd.exe

There are two exclusion lists that need setting as follows:

   1. Right click on either “Norton Internet Security” or “Norton SystemWorks” bottom right
      corner of the system tray and select open.
   2. In the pop-up click on options and select Norton Antivirus.
   3. Click on Auto-Protect (this expands the menu options)
   4. Click on Exclusions. A new window opens.
   5. Click the New button
   6. Type in SlimFTPd_3.16.exe un-check Include subfolders and click OK button
   7. Repeat step 5 for file SlimFTPd.exe
   8. Make sure the file names are correct and click the OK button
   9. This closes the window and takes you back to position as in step 2. Again click on
      options and select Norton Antivirus
  10. Click on Manual Scan (this expands the menu options)
  11. Click on Exclusions.
  12. You know the drill click the New button
  13. Type in SlimFTPd_3.16.exe un-check Include subfolders and click OK button
  14. Repeat step 12 for file SlimFTPd.exe
  15. Make sure the file names are correct and click the OK button

Note: Pop your servers on a memory stick run them on a friends machine and if he’s running
Norton expect SlimFTPd.exe to be blasted away pain that! Hence you need to perform the above to prevent this.

Firewall Programs

If you cannot access your FTP server locally the cause is probably your firewall. When a new program attempts for the first time to accesses the Internet, firewalls ring bells and display various alerts. They require confirmation to allow a program access. When challenged allow access on all ports or whatever they require to allow access. If you accidentally deny access you need to open the firewall configuration and set the appropriate bits, again that’s another trip on the Internet and visit their site for details.

Router

Routers do an excellent job of protecting you on the Internet they are normally set to block various ports. Your FTP server requires port 21 to be accessible from the Internet, check your router, enable port forwarding if its disabled. You will find details in your routers manual, alternatively check out this site portforward scroll down the page and locate your router, click link and follow the instructions. If your router is not listed! Inform them what planet you obtained it from.

Top

Stopping the FTP server

The server was started as a standard program (not as a service) hence the program will terminate when you turn your PC off. This means when you want to use the FTP server again you will need to manually restart the program (double click on SlimFTPd.exe). Note: Your firewall will not challenge access its already set-up to allow a connection.

If you want to close SlimFTPd before switching your PC off use “Windows Task Manager” to kill the program (process).

  1. Bring up task manager (press ctrl, alt and del keys at the same time)
  2. Click the Processes tab
  3. Scroll either up or down, locate the process name SlimFTPd.exe
  4. Right mouse click on this name and select “End Process”
  5. Click Yes to confirm


Note 1: Killing programs XP Home supports tskill, run it from from a command prompt e.g. tskill SlimFTPd /A. Trouble is it does not work on all programs SlimFTPd being one of these, hence the above long winded procedure.

Note 2: An alternative is to use uc_kill_process.bat double click to run. This uses Uniform Servers pskill.exe (found in folder uc_tskill) it was written especially for this scenario.

Server Start and Stop

Summary how to start and stop FTP server:

  • Start SlimFTP - Double click on SlimFTPd.exe
  • Stop SlimFTP - Double click on uc_kill_process.bat

Note: You can run the server as a service see below. Before installing as a service use uc_kill_process.bat to kill the server if its running.

Top

Run as a Service

Running SlimFTPd as a standard program in the event of a power failure or after turning your PC on, SlimFTPd requires manually restarting . You may want the program to automatically start hence install SlimFTPd as a service.

Install Service:

  1. Double click on ServiceTool.exe
  2. Click on Install (toggle button)
  3. Click Close Tool

Run Service:

  1. Double click on uc_start_service.bat
     OR
  2. Start a command prompt and
    type: net start slimftpd
 

Uninstall Service:

  1. Stop service if running (Double click on uc_stop_service.bat)
  2. Double click on ServiceTool.exe
  3. Click on UnInstall (toggle button)
  4. Click Close Tool

Stop Service:

  1. Double click on uc_stop_service.bat
     OR
  2. Start a command prompt and
    type: net stop slimftpd

Try the above, install and run as a service. Now perform the previous browser tests, you will see it functions identically . After testing stop and uninstall the service. The tutorial assumes you are running the server as a standard program.

Note: When run the service tool toggles install/unistall button depending on service state.

Top

Configuration file introduction

Open the configuration file slimftpd.conf in a text editor, you will find it surprisingly sparse. The original contains detailed comments, for clarity I have removed these allowing you to see the real detail.

Commands Description

#### Global server variables

BindInterface All
BindPort 21
CommandTimeout 300
ConnectTimeout 15
MaxConnections 20
LookupHosts On

These instruction define the FTP server's variables. The defaults should be adequate for most application hence no need to change.

#### User accounts

<User "ric">
  Password "unicenter"
  Mount / C:/uc_slimftpd_tutorial
  Allow / All
</User>

Each user account (profile) starts with an opening tag <User "name"> and finishes with a closing tag </User> every user block can be tailored.

Password: Along with User name forces authentication for access.
Mount /: Think of this as the servers top level (document root) what follows is the location of a folder that will be mapped
into this document root C:/uc_slimftpd_tutorial. All files and sub folders contained in folder C:/uc_slimftpd_tutorial will be served.
Allow /: Defines permissions, what a user is allowed to do.

If you only want to serve from a single folder and all it's sub-folder the above is all you require in your configuration file.

Top

Summary

You now have a fully functioning FTP server and know how to run it either as a standard program or a service. When installed as a Uniform Server plugin the FTP server is run as a standard program making it portable.

I introduced the FTP configuration file simply to show how the server has been locked down for single folder access hence making it safe when testing on-line for Internet access.

I will be covering the configuration in more detail, before doing that would like to introduce you to FTP browsers Clients.

Top


  Ric