YAFS - instruction manual

Content of this manual
  • Introduction
  • Basic features and compatibility
  • Additional command line parameters
  • FTP commands reference list
    • CDUP
    • SYST
    • PASV
    • QUIT
    • PWD
    • USER
    • PASS
    • LIST
    • ABOR
    • CWD
    • TYPE
    • MKD
    • DELE
    • RMD
    • STOR
    • RETR
    • NOOP
    • APPE
    • PORT
    • REST
    • RNFR
    • RNTO
    • TYPE (not supported, see note)
    • MDTM
    • SIZE
    • SITE
  • Administration
    • PassWord
    • RootDirectory
    • AllowFullBandwidth
    • CloseIfIdle
    • DiskQuota
    • AddCommand
    • AllowIPAddress
  • Configuration
    • Port
    • Address
    • ExternIP
    • DataPort
    • MaxUSers
    • MaximumBandwidth
    • TimeoutTime

Introduction

YAFS was made because I already had Snug HTTP server and was not fully satisfied with running somebody elses FTP server software. And the FTP servers I tried was frankly speaking crap. They were hard to configure and had a GUI. I don't think a serious server needs a GUI. Writing an FTP server is more challenging and complex than writting an HTTP server. But I'm very pleased with the result. YAFS supports all the basic FTP commands that enables a user to do disk operations on the server. An optional bandwidth restriction feature is implemented. The server is capable of recursive removal of whole directory trees if necessary. A small number of other features is implemented. YAFS is small and simple to configure and uses very little system resources. YAFS is tested on a laptop running at 25 MHz with 4 MB of RAM. The only operating system I was able to install was Windows for Workgroups 3.11. I had a stable speed of 350 kb/s when downloading a file from the laptop.

YAFS uses the same license agreement text as Snug HTTP server. YAFS also shares the same setup procedure as Snug HTTP server. If you think that some part of the instruction manual is missing, refer to the instruction manual for Snug HTTP server.


Basic features and compatibility

Several user accounts can exist and several clients can be connected simoultaniously. Even multiple logins using the same account file is possible. Both active (using PORT) and passive mode (using PASV) is supported. Console log can be enabled with parameter -puke. All the basic FTP commands are supported. The LIST format is a windowized version of the commonly used /bin/ls format. The server is designed to support as many FTP clients as possible. YAFS is tested with LeechFTP 1.3, WS_FTP 5.08, WS FTP Professional 2006, Opera 8.01, Internet Explorer (unknown version), AceFTP 3.70.3, CuteFTP 7.1, NFTP 1.71 for OS/2 (i386), NetPenguin 1.64 (BeOS) and some other.

FTP commands reference list

Below is a list of supported commmands with a short description. The server will respond with 502 Command not implemented. if the command is not supported. Some commands belongs to the default command set which is implemented for all users (for example USER and NOOP). Some commands must be added for each user.

CDUP
Change to parent directory on server system (if not already at top level). Any argument to CDUP will be ignored.

SYST
Returns server identification. Any argument to SYST will be ignored. This command is added in the default command set.

PASV
Initializes data transfer using passive FTP where the client connects to the server. Any argument to PASV will be ignored.

QUIT
Logout and break all connections associated with the client. This command is added in the default command set.

PWD
Show current directory name on remote system. This command is added in the default command set.

USER
Required for all logins and must be the first command sent to the server. An argument specifying a valid username is required. This command is added in the default command set.

PASS
Required for all users with a password set. This command is added in the default command set.

LIST
Create directory listing. The server will send a faked empty directory listing in response to LIST if LIST is not supported. This is usefull when setting up an account that is used for submitting files to a site. For this purpose it is only necesary to allow FTP commands STOR, PORT and PASV. A user can still overwrite files on the server but needs to know the name of that file (which is hidden as the server returned an empty directory listing).

ABOR
Close current transfer. This command is added in the default command set.

CWD
Change working directory on server system. Absolute path can be given as parameter (/usr/root/ or /usr/root) or relative path (root). An argument is required.

TYPE
Turn the binary flag on or off. The command is recognised by the server but functionality is not implemented in this version. TYPE is used for compatibility between different operating systems. For example when transferring text files between UNIX and Microsoft Windows. If you encounter problems, try to add AddCommand=TYPE in the affected account file. Some clients require TYPE to be supported by the server.

MKD
Make directory on server system. Argument can be the relative or absolute path. An argument is required.

DELE
Delete file on server system. Argument can be the relative or absolute path. An argument is required.

RMD
Delete directory on server system. Argument can be the relative or absolute path. An argument is required.

STOR
Store file on server system, over-writing the file if it already exists. Argument can be the relative or absolute path. An argument is required.

RETR
Get file from server system. Argument can be the relative or absolute path. An argument is required.

NOOP
Resets the timeout value. Any argument to NOOP will be ignored. This command is added in the default command set.

APPE
Append data to existing file or create if not exist (see STOR).

PORT
Initializes data transfer using active FTP where the server connects to the client. An argument is required.

REST
This command is used to resume a transfer by setting the file pointer. No argument to REST will be treated as REST 0.

RNFR
This command is used to rename files or directories. This command must be followed by RNTO. An argument is required.

RNTO
This command is used to rename files or directories. This command must be preceded by RNFR. An argument is required.

MDTM
MDTM returns the last-modified time of the given file. The time will be in GMT.

SIZE
SIZE returns the size of the given file in bytes (octets).

SITE
SITE can be used by a client to execute any command on the server not supported by the client (if SITE is supported). SITE MDTM file.txt is equal to MDTM file.txt. SITE MDTM file.txt will only work if both MDTM and SITE is supported by the server and SITE is supported by the client.


Administration and account files

Accounts are stored in the accounts directory located in a sub-directory to the bin directory as plain text ini-files and can be edited with any text editor. Account files are named with the desired user account name and the file extension is ini. Account file names can only contain characters from a-z, A-Z, 0-9 and _. YAFSW16.exe can only handle 8.3 filenames. Usernames must thus be 8 characters or shorter in length. You can copy and modify the sample user account file Anonymous.ini or its equivalent WFW311.ini to create new accounts. An account file is read each time a user is logged in. Changing the file extension will dissable the account. Some parameters are limited in length or in range and can cause the server to display an error message in the console when a user tries to log on using the affected account. Critical errors will disable the account. Remember to enable no more commands than necessary.

PassWord
This is the user password and can contain characters from the full typeable ASCII set. If the maximum length is exceeded an error message will be displayed when a user tries to log on.

DiskQuota
Disk quota in bytes. DiskQuota=0 gives user unlimited quota. DiskQuota=10485760 gives the user 10 MB disk quota. The disk quota is stored in the USERNAME.dsk file, where USERNAME is the user name. This file is created and updated automaticly. If the the disk quota is changed the file is updated when a user logs off if DiskQuota is not 0.

RootDirectory
This is the users root directory. Full path is required (e.g. d: and c:\ftproot\user or /home on *NIX systems). A user can modify the content in this directory if the right permissions are set. If the maximum length is exceeded an error message will be displayed when a user tries to log on.

AllowFullBandwidth
A bandwidth limit can be applied for the whole server in the main configuration. AllowFullBandwidth=yes overrides this limit for individual users. Use AllowFullBandwidth=no to restrict the bandwidth to what is given in the main configuration file.

CloseIfIdle
CloseIfIdle=no will prevent the server from closing the connection if idle. CloseIfIdle=yes will close the connection if it becomes idle. A client can send the NOOP command to keep the connection alive.

AddCommand
Add allowed command (e.g. AddCommand=RETR). See section FTP commands reference list for list of available commands. YAFS supports a recursive version of RMD, called RMD_RECURSIVE. Use AddCommand=RMD_RECURSIVE instead of AddCommand=RMD if you wish to enable recursive version of RMD command. A user calls RMD as normal but the server performs a recursive removal of all files and sub-directories in the specified directory. RMD_RECURSIVE can be memory and CPU intens, so use it with care. RMD_RECURSIVE blocks the server until it is finished. Using RMD_RECURSIVE always returns 250 (success), but will tell if an error was encountered during processing.

AllowIPAddress
Allowed IP-address. The server will only accept the user if the connection was made from this IP-address. Enter AllowIPAddress=ALL to allow all addresses.

Configuration

yafs.ini is the default configuration file. Same rules apply for this file as for the account files. All lines must be terminated with line-feed or carriage return (simply press enter or return).

Port
Server listening port (usually 21 for FTP services). 2121 is recommended as some ISPs (Internet Service Provider) don't allow servers on port 21. Any free port on the choosen interface can be used.

Address
Address=xxx.xxx.xxx.xxx, where xxx.xxx.xxx.xxx is the IP address of the NIC and xxx is a one to three digit number. Enter AUTO for auto-detect (Microsoft Windows only). You can use 127.0.0.1 (localhost) when testing the server.

ExternIP
A gateway is a network point that acts as an entrance to another network. If you are using a gateway you must specify ExternIP which is the public address facing the other network (for example the Internet). If you don't use a gateway you should specify the same address as in Address. You can use AUTO to set ExternIP=Address (works for some routers that uses NAT and automaticly translates the address). Usually your computer is connected to an ethernet router which in turn is connected to a broadband modem. The address assigned to you by your ISP is the WAN IP.

DataPort
The data port range is calculated as DataPort to DataPort+MaxUsers. If you use DataPort=32769 and MaxUsers=10, then you will have to open port 32769 to 32779 in your firewall. Valid data port range is 0 to 65534.

MaxUSers
The maximum number of connections the server will accept simultaneously (10 is recommended). The more user allowed the slower the transfer rate for each user will be.

MaximumBandwidth
A bandwidth limit can be applied for all accounts. MaximumBandwidth=10 will limit the total upload and download speed to appr. 10 kB/s. This will also affect file listings but not data sent on the control connection. Set MaximumBandwidth=0 to disable the BW limit feature. The total bandwidth used by the server may exceed MaximumBandwidth when new connections are established.

TimeoutTime
Clients who have been idle (no messages or data sent) for Timeout seconds will be disconnected. This can be override in the account file. Timeout with value 0 can be used which will disable the timeout feature (not recommended).