Q : How can your own script interact with RaidenFTPD ?

A : Why do someone want to create a script that can interact with RaidenFTPD ? That is because that with the newly introduced interface ask:// , you can tell RaidenFTPD "what to do" , for example , deny user from logging in , deny directory to be created , deny files to be uploaded .

[SECTION 1 : Ask external programs for permission on doing something]

01. first choose your favorite programming language , in this example we use PHP
02. write your own script/program , and get it ready
03. open your server file *.ftpd
04. find the line under [FTPD] , onNewDir=

*. note : the only events that support ask/reply interaction are
- onUserLogin : executed before the user login procedure is permitted

- onFilePreUpload : executed before the user can gain the permission to upload a file

- onNewDir : executed before the user creates a directory

- onFilePreDelete : executed before the user actually deletes a file

- onFileDeleted: executed after the user actually deletes a file * using ask:// here will allow you to display messages to ftp client

- onDelDir : executed before the user actually deletes a directory

- onPreCwd : executed before the Change Working Directory event

- onFileUploaded : executed after a file is uploaded , * the first line of your output file is ignored in this event

- onZipUploaded : executed after a zip file is uploaded , * the first line of your output file is ignored in this event

05. in this example , our php run time library path is c:\php-bin , and the script name is
06. edit this line , make it onNewDir=ask://c:\php-bin\php.exe askdir.php %@ %G
07. note that the askdir.php must be placed in c:\php-bin
08. note that %@ variable (GCID) is new , and only appears in RaidenFTPD v2.1 build 983+
09. note that you must use the latest RaidenFTPD v2.2 build 299+ or this ask:// will not work
10. note that %@ is *REQUIRED* for anyone who wish to create ask/reply interface
11. note that %G is the full physical path variable , and it is not required for every command ,
we just use it here as an example
12. after you have done what you want to do , you must write the output file to
c:\Program Files\RaidenFTPD\Output\ask-onNewDir.[GCID]
12. eg: GCID(%@)=a45848 , event=onNewDir, you must write your output file to
c:\Program Files\RaidenFTPD\Output\ask-onNewDir.a45848
* for other events you need ask-onFilePreUpload.a45848 and ask-onUserLogin.a45848 ...
13. the output file format must follow the following guidelines
* first line contains only one character : 0 or 1 , 0 means disallowing the command , 1 means allowing the command
* from the second line to the end of file , contains messages you want to disply to the ftp user , it can be multi-lines
* each line of text should not exceed 80 characters
* you must use "\n" as new line character , do not use "\r" or "\n\r"
* a sample of successful output file can be found as "sample/ok.txt" inside this package
* a sample of failure output file can be found as "sample/fail.txt" inside this package

14. the server will not clean up the Output directory for you , you need to clean it up
by your self.

to download the additional ask/reply interface SDK , please click here

[SECTION 2 : External programs tell the server to run some commands]

01. this must be used with the procedures in section 1
02. in the output file you made in section 1 , the first line is always the allow/disallow , from the second line , you can start to put some commands...

to run a command under the current level (current account) , put this line in the output file (not in first line)

#command<new line>


#site undupe filename-a<new line>

note that <new line> is the new line character \n , it should not be visible in a normal text editor

note : <new line> is the new line character \n , it should not be visible in a normal text editor

note : no nested event will be triggered , such as if you send a #CWD /xxx on onPreCwd event , the onPreCwd won't be triggered again

If you wish to perform a command under root level , use the following format

#sudo command


#sudo site give john 1000

note : you can not use sudo to change user's level



REVISION 2.2 , 2002/06/06