OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 <head> |
| 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 <title>pyftpdlib FAQs</title> |
| 6 </head> |
| 7 |
| 8 <body> |
| 9 <div id="wikicontent"> |
| 10 <h1><a name="1.0_-_Introduction" id="1.0_-_Introduction">1.0 - Introduction</a
></h1> |
| 11 <h3><a name="1.1_-_What_is_pyftpdlib?" id="1.1_-_What_is_pyftpdlib?">1.1 - Wha
t is pyftpdlib?</a></h3> |
| 12 <p><a name="1.1_-_What_is_pyftpdlib?" id="1.1_-_What_is_pyftpdlib?">pyftpdlib
is a high-level library to easily write asynchronous portable FTP servers with <
/a><a href="http://www.python.org/" rel="nofollow">Python</a>. </p> |
| 13 <h3><a name="1.2_-_What_is_Python?" id="1.2_-_What_is_Python?">1.2 - What is P
ython?</a></h3> |
| 14 <p><a name="1.2_-_What_is_Python?" id="1.2_-_What_is_Python?">Python is an int
erpreted, interactive, object-oriented, easy-to-learn programming language. It i
s often compared to <em>Tcl, Perl, Scheme</em> or <em>Java</em>. </a></p> |
| 15 <h3><a name="1.3_-_I'm_not_a_python_programmer._Can_I_use_it_anyway?" id="1.3_
-_I'm_not_a_python_programmer._Can_I_use_it_anyway?">1.3 - I'm not a python prog
rammer. Can I use it anyway?</a></h3> |
| 16 <p><a name="1.3_-_I'm_not_a_python_programmer._Can_I_use_it_anyway?" id="1.3_-
_I'm_not_a_python_programmer._Can_I_use_it_anyway?">Yes. pyftpdlib is a fully wo
rking FTP server implementation that can be run "as is". For example,
(after having installed a </a><a href="http://www.python.org/download/" rel="nof
ollow">Python interpreter</a>) you could run an anonymous ftp server from cmd-li
ne by running: </p> |
| 17 <pre>python -m pyftpdlib.ftpserver</pre> |
| 18 <p>Customizing ftpd for basic tasks like adding users or deciding where log f
ile should be placed is mostly simply editing variables. This is basically lik
e learning how to edit a common unix ftpd.conf file and doesn't really require
Python knowledge. Customizing ftpd more deeply requires a python script which i
mports pyftpdlib to be written separately. An example about how this could be d
one are the scripts contained in the <a href="http://code.google.com/p/pyftpdlib
/source/browse/trunk/demo" rel="nofollow">demo directory</a>. </p> |
| 19 <h3><a name="1.4_-_Documentation" id="1.4_-_Documentation">1.4 - Documentation
</a></h3> |
| 20 <p><a href="http://code.google.com/p/pyftpdlib/" rel="nofollow">http://code.go
ogle.com/p/pyftpdlib/</a> is the primary source for all information about the pr
oject including <a href="http://code.google.com/p/pyftpdlib/wiki/Install" rel="n
ofollow">Install instructions</a>, <a href="http://code.google.com/p/pyftpdlib/w
iki/Tutorial" rel="nofollow">Tutorial</a>, <a href="http://code.google.com/p/pyf
tpdlib/wiki/RFCsCompliance" rel="nofollow">RFCs Compliance paper</a>, <a href="h
ttp://code.google.com/p/pyftpdlib/w/list" rel="nofollow">Wikis</a> and the <a hr
ef="http://code.google.com/p/pyftpdlib/issues/list" rel="nofollow">Bug Tracker</
a>. </p> |
| 21 <h3><a name="1.5_-_Mailing_lists" id="1.5_-_Mailing_lists">1.5 - Mailing lists
</a></h3> |
| 22 <p><a name="1.5_-_Mailing_lists" id="1.5_-_Mailing_lists">There are a number o
f mailing lists for pyftpdlib: </a></p> |
| 23 <table border="1"> |
| 24 <tbody> |
| 25 <tr> |
| 26 <td><strong>Name</strong> </td> |
| 27 <td><strong>E-mail</strong> </td> |
| 28 <td><strong>Web Interface</strong> </td> |
| 29 <td><strong>Description</strong> </td> |
| 30 </tr> |
| 31 <tr> |
| 32 <td><a href="http://groups.google.com/group/pyftpdlib" rel="nofollow">py
ftpdlib</a> </td> |
| 33 <td> pyftpdlib@googlegroups.com </td> |
| 34 <td><a href="http://groups.google.com/group/pyftpdlib/topics" rel="nofol
low">topics</a> </td> |
| 35 <td> This is intended for end user support. </td> |
| 36 </tr> |
| 37 <tr> |
| 38 <td><a href="http://groups.google.com/group/pyftpdlib-commit" rel="nofol
low">pyftpdlib-commit</a> </td> |
| 39 <td> pyftpdlib-commits@googlegroups.com </td> |
| 40 <td><a href="http://groups.google.com/group/pyftpdlib-commit/topics" rel
="nofollow">topics</a> </td> |
| 41 <td> This list receives all change notifications for code in the Subvers
ion repository. Unless you're a pyftpdlib developer you will probably not be i
nterested in it. </td> |
| 42 </tr> |
| 43 <tr> |
| 44 <td><a href="http://groups.google.com/group/pyftpdlib-issues" rel="nofol
low">pyftpdlib-issues</a> </td> |
| 45 <td> pyftpdlib-issues@googlegroups.com </td> |
| 46 <td><a href="http://groups.google.com/group/pyftpdlib-issues/topics" rel
="nofollow">topics</a> </td> |
| 47 <td> This list receives all change notifications from the <a href="http:
//code.google.com/p/pyftpdlib/issues/list" rel="nofollow">Bug Tracker</a>. Unles
s you are involved into pyftpdlib development you will probably not find this us
eful. </td> |
| 48 </tr> |
| 49 </tbody> |
| 50 </table> |
| 51 <h1></h1> |
| 52 <h3><a name="1.6_-_Bug_reporting" id="1.6_-_Bug_reporting">1.6 - Bug reporting
</a></h3> |
| 53 <p><a name="1.6_-_Bug_reporting" id="1.6_-_Bug_reporting">Bug reports should b
e made via Google Code </a><a href="http://code.google.com/p/pyftpdlib/issues/li
st" rel="nofollow">Issue Tracker</a>. Patches should be attached to the appropri
ate bug and not mailed directly to the mailing lists or any given team member. <
/p> |
| 54 <h1><a name="2.0_-_Installing_and_compatibility" id="2.0_-_Installing_and_comp
atibility">2.0 - Installing and compatibility</a></h1> |
| 55 <h3><a name="2.1_-_How_do_I_install_pyftpdlib?" id="2.1_-_How_do_I_install_pyf
tpdlib?">2.1 - How do I install pyftpdlib?</a></h3> |
| 56 <p><a name="2.1_-_How_do_I_install_pyftpdlib?" id="2.1_-_How_do_I_install_pyft
pdlib?">If you are not new to Python you probably don't need that, otherwise fol
low the </a><a href="http://code.google.com/p/pyftpdlib/wiki/Install" rel="nofol
low">instructions</a>. </p> |
| 57 <h3><a name="2.2_-_Which_Python_versions_are_compatible?" id="2.2_-_Which_Pyth
on_versions_are_compatible?">2.2 - Which Python versions are compatible?</a></h3
> |
| 58 <p><a href="http://www.python.org/download/releases/2.3.6/" rel="nofollow">Pyt
hon 2.3</a> and higher. </p> |
| 59 <h3><a name="2.3_-_Which_one_is_recommended?" id="2.3_-_Which_one_is_recommend
ed?">2.3 - Which one is recommended?</a></h3> |
| 60 <p><a name="2.3_-_Which_one_is_recommended?" id="2.3_-_Which_one_is_recommende
d?">Python <strong>2.4</strong> or higher because of the newer collection.deque
object which provides better performances for file transfers. </a></p> |
| 61 <h3><a name="2.4_-_What_about_Python_3.x?" id="2.4_-_What_about_Python_3.x?">2
.4 - What about Python 3.x?</a></h3> |
| 62 <p><a name="2.4_-_What_about_Python_3.x?" id="2.4_-_What_about_Python_3.x?">Py
thon 3.0 is still in beta version thus not yet covered. A porting of pyftpdlib t
o Python 3k is in plan, anyway. </a></p> |
| 63 <h3><a name="2.5_-_On_which_platforms_can_pyftpdlib_be_used?" id="2.5_-_On_whi
ch_platforms_can_pyftpdlib_be_used?">2.5 - On which platforms can pyftpdlib be u
sed?</a></h3> |
| 64 <p><a name="2.5_-_On_which_platforms_can_pyftpdlib_be_used?" id="2.5_-_On_whic
h_platforms_can_pyftpdlib_be_used?">pyftpdlib should work on any platform where
<strong><em>select()</em></strong> or <strong><em>poll()</em></strong> system ca
lls are available and on any Python implementation which refers to <strong>CPyth
on 2.3</strong> or superior (e.g CPython 2.6 or PythonCE 2.5). The development t
eam has mainly tested it under various <strong>Linux</strong>, <strong>Windows</
strong>, <strong>OS X</strong> and <strong>FreeBSD</strong> systems. For FreeBS
D is also available a </a><a href="http://www.freshports.org/ftp/py-pyftpdlib/"
rel="nofollow">pre-compiled package</a> maintained by Li-Wen Hsu <lwhsu@freeb
sd.org>. Other Python implementation like <strong><a href="http://pythonce.so
urceforge.net/" rel="nofollow">PythonCE</a></strong> are known to work with pyft
pdlib and every new version is usually tested against it. pyftpdlib currently do
es not work on <strong><a href="http://www.jython.org/" rel="nofollow">Jython</a
></strong> since the latest Jython release refers to CPython 2.2.x serie. </p> |
| 65 <h1><a name="3.0_-_Usage" id="3.0_-_Usage">3.0 - Usage</a></h1> |
| 66 <h3><a name="3.1_-_Why_do_I_get_socket.error_'Permission_denied'_er" id="3.1_-
_Why_do_I_get_socket.error_'Permission_denied'_er">3.1 - Why do I get socket.err
or "Permission denied" error on ftpd starting?</a></h3> |
| 67 <p><a name="3.1_-_Why_do_I_get_socket.error_'Permission_denied'_er" id="3.1_-_
Why_do_I_get_socket.error_'Permission_denied'_er">Probably because you're on a u
nix system and you're trying to start ftpd as an unprivileged user. <em>ftpserve
r.py</em> binds on port 21 by default and only super-user account (e.g. root) c
ould bind sockets on such ports. If you want to bind ftpd as non-privileged use
r you should set a port higher than 1024. </a></p> |
| 68 <h3><a name="3.2_-_How_can_I_prevent_the_server_version_from_being_displayed?"
id="3.2_-_How_can_I_prevent_the_server_version_from_being_displayed?">3.2 - How
can I prevent the server version from being displayed?</a></h3> |
| 69 <p><a name="3.2_-_How_can_I_prevent_the_server_version_from_being_displayed?"
id="3.2_-_How_can_I_prevent_the_server_version_from_being_displayed?">Just overr
ide and modify banner attribute of FTPHandler class. </a></p> |
| 70 <h3><a name="3.3_-_Can_control_upload/download_ratios?" id="3.3_-_Can_control_
upload/download_ratios?">3.3 - Can control upload/download ratios?</a></h3> |
| 71 <p><a name="3.3_-_Can_control_upload/download_ratios?" id="3.3_-_Can_control_u
pload/download_ratios?">Yes. </a><a href="http://pyftpdlib.googlecode.com/svn/tr
unk/demo/throttled_ftpd.py" rel="nofollow">throttled_ftpd.py</a> script included
in the demo directory implements bandwidth throttling capabilities for both upl
oad and download. </p> |
| 72 <h3><a name="3.4_-_Are_there_ways_to_limit_connections?" id="3.4_-_Are_there_w
ays_to_limit_connections?">3.4 - Are there ways to limit connections?</a></h3> |
| 73 <p><a name="3.4_-_Are_there_ways_to_limit_connections?" id="3.4_-_Are_there_wa
ys_to_limit_connections?">FTPServer class comes with two overridable attributes
defaulting to zero (no limit): max_cons, which sets a limit for maximum simultan
eous connection to handle by ftpd and max_cons_per_ip which set a limit for con
nections from the same IP address. Overriding these variables is always recomme
nded to avoid DoS attacks. </a></p> |
| 74 <h3><a name="3.5_-_I'm_behind_a_NAT_/_gateway" id="3.5_-_I'm_behind_a_NAT_/_ga
teway">3.5 - I'm behind a NAT / gateway</a></h3> |
| 75 <p><a name="3.5_-_I'm_behind_a_NAT_/_gateway" id="3.5_-_I'm_behind_a_NAT_/_gat
eway">When behind a NAT a ftp server needs to replace the IP local address dis
played in PASV replies and instead use the public address of the NAT to allow c
lient to connect. By overriding masquerade_address attribute of FTPHandler clas
s you will force pyftpdlib to do such replacement. However, one big problem sti
ll exists. The passive FTP connections will use ports from 1024 and up, which m
eans that you must forward all ports 1024-65535 from the NAT to the FTP server!
And you have to allow many (possibly) dangerous ports in your firewalling rule
s! To resolve this, simply override passive_ports attribute of FTPHandler class
to control what ports proftpd will use for its passive data transfers. Value e
xpected by passive_ports attribute is a list of integers (e.g. range(60000, 655
35)) indicating which ports will be used for initializing the passive data chan
nel. </a></p> |
| 76 <h3><a name="3.6.1_-_What_is_FXP?" id="3.6.1_-_What_is_FXP?">3.6.1 - What is F
XP?</a></h3> |
| 77 <p><a name="3.6.1_-_What_is_FXP?" id="3.6.1_-_What_is_FXP?">FXP is part of the
name of a popular Windows FTP client: </a><a href="http://www.flashfxp.com" rel
="nofollow">http://www.flashfxp.com</a>. This client has made the name "FX
P" commonly used as a synonym for site-to-site FTP transfers, for transfer
ring a file between two remote FTP servers without the transfer going through t
he client's host. Sometimes "FXP" is referred to as a protocol; in fa
ct, it is not. The site-to-site transfer capability was deliberately designed i
nto <a href="http://www.faqs.org/rfcs/rfc959.html" rel="nofollow">RFC-959</a>. M
ore info can be found here: <a href="http://www.proftpd.org/docs/howto/FXP.html"
rel="nofollow">http://www.proftpd.org/docs/howto/FXP.html</a>. </p> |
| 78 <h3><a name="3.6.2_-_Does_pyftpdlib_support_FXP?" id="3.6.2_-_Does_pyftpdlib_s
upport_FXP?">3.6.2 - Does pyftpdlib support FXP?</a></h3> |
| 79 <p><a name="3.6.2_-_Does_pyftpdlib_support_FXP?" id="3.6.2_-_Does_pyftpdlib_su
pport_FXP?">Yes. It is disabled by default for security reasons (see </a><a href
="http://gim.org.pl/rfcs/rfc2577.html" rel="nofollow">RFC-2257</a> and <a href="
http://www.cert.org/advisories/CA-1997-27.html" rel="nofollow">FTP bounce attack
description</a>) but in case you want to enable it just set to True the permit_
foreign_addresses attribute of FTPHandler class. </p> |
| 80 <h1><a name="4.0_-_Implementation" id="4.0_-_Implementation">4.0 - Implementat
ion</a></h1> |
| 81 <h3><a name="4.1_-_Globbing_/_STAT_command_implementation" id="4.1_-_Globbing_
/_STAT_command_implementation">4.1 - Globbing / STAT command implementation</a><
/h3> |
| 82 <p><a name="4.1_-_Globbing_/_STAT_command_implementation" id="4.1_-_Globbing_/
_STAT_command_implementation">Globbing is a common Unix shell mechanism for exp
anding wildcard patterns to match multiple filenames. When an argument is provi
ded to the <strong>STAT</strong> command, ftpd should return directory listing o
ver the command channel. </a><a href="http://www.faqs.org/rfcs/rfc959.html" rel=
"nofollow">RFC-959</a> does not explicitly mention globbing; this means that FTP
servers are not required to support globbing in order to be compliant. However
, many FTP servers do support globbing as a measure of convenience for FTP cli
ents and users. In order to search for and match the given globbing expression,
the code has to search (possibly) many directories, examine each contained fil
ename, and build a list of matching files in memory. Since this operation can b
e quite intensive, both CPU- and memory-wise, pyftpdlib does not support globbi
ng. </p> |
| 83 <h3><a name="4.2_-_ASCII_transfers_/_SIZE_command_implementation" id="4.2_-_AS
CII_transfers_/_SIZE_command_implementation">4.2 - ASCII transfers / SIZE comman
d implementation</a></h3> |
| 84 <p><a name="4.2_-_ASCII_transfers_/_SIZE_command_implementation" id="4.2_-_ASC
II_transfers_/_SIZE_command_implementation">Properly handling the SIZE command
when TYPE ASCII is used would require to scan the entire file to perform the AS
CII translation logic (file.read().replace(os.linesep, '\r\n')) and then calcul
ating the len of such data which may be different than the actual size of the f
ile on the server. Considering that calculating such result could be very reso
urce-intensive it could be easy for a malicious client to try a DoS attack, thu
s pyftpdlib do not perform the ASCII translation. However, clients in general s
hould not be resuming downloads in ASCII mode. Resuming downloads in binary mod
e is the recommended way as specified in </a><a href="http://www.faqs.org/rfcs/
rfc3659.html" rel="nofollow">RFC-3659</a>. </p> |
| 85 <h3><a name="4.3.1_-_IPv6_support" id="4.3.1_-_IPv6_support">4.3.1 - IPv6 supp
ort</a></h3> |
| 86 <p><a name="4.3.1_-_IPv6_support" id="4.3.1_-_IPv6_support">Starting from vers
ion 0.4.0 pyftpdlib <em>supports</em> IPv6 (</a><a href="http://www.faqs.org/rfc
s/rfc2428.html" rel="nofollow">RFC-2428</a>). If you use IPv6 and want your FTP
daemon to do so just pass a valid IPv6 address to the FTPServer class construc
tor. Example: </p> |
| 87 <pre>>>> from pyftpdlib import ftpserver<br />>>> address =
("::1", 21) # listen on localhost, port 21<br />>>> ftpd = f
tpserver.FTPServer(address, ftpserver.FTPHandler)<br />>>> ftpd.serve_f
orever()<br />Serving FTP on ::1:21</pre> |
| 88 <h3><a name="4.3.2_-_How_do_I_install_IPv6_support_on_my_system?" id="4.3.2_-_
How_do_I_install_IPv6_support_on_my_system?">4.3.2 - How do I install IPv6 suppo
rt on my system?</a></h3> |
| 89 <p><a name="4.3.2_-_How_do_I_install_IPv6_support_on_my_system?" id="4.3.2_-_H
ow_do_I_install_IPv6_support_on_my_system?">If you want to install IPv6 support
on Linux run "modprobe ipv6", then "ifconfig". This should
display the loopback adapter, with the address "::1". You should the
n be able to listen the server on that address, and connect to it. </a></p> |
| 90 <p><a name="4.3.2_-_How_do_I_install_IPv6_support_on_my_system?" id="4.3.2_-_H
ow_do_I_install_IPv6_support_on_my_system?">On Windows (XP SP2 and higher) run &
quot;netsh int ipv6 install". Again, you should be able to use IPv6 loopbac
k afterwards. </a></p> |
| 91 <h3><a name="4.4_-_Can_pyftpdlib_be_integrated_with_'real'_users_ex" id="4.4_-
_Can_pyftpdlib_be_integrated_with_'real'_users_ex">4.4 - Can pyftpdlib be integr
ated with "real" users existing on the system?</a></h3> |
| 92 <p><a name="4.4_-_Can_pyftpdlib_be_integrated_with_'real'_users_ex" id="4.4_-_
Can_pyftpdlib_be_integrated_with_'real'_users_ex">Yes. By using the proper syst
em dependent authorizer pyftpdlib can look into the system account database to
authenticate users. Starting from version 0.4.0 the DummyAuthorizer class provi
des two new methods: impersonate_user() and terminate_impersonation(). System d
ependent authorizers subclassing the dummy authorizer can assume the id of real
users by overriding them as necessary. Every time the FTP server is going to a
ccess the filesystem (e.g. for creating or renaming a file) it will temporarily
impersonate the currently logged on user, execute the filesystem call and then
switch back to the user who originally started the server. Example UNIX and Wi
ndows FTP servers contained in the </a><a href="http://code.google.com/p/pyftpd
lib/source/browse/#svn/trunk/demo" rel="nofollow">demo directory</a> implement b
oth real user impersonation and authentication against the system users database
. </p> |
| 93 <h3><a name="4.5_-_SSL/TLS_support" id="4.5_-_SSL/TLS_support">4.5 - SSL/TLS s
upport</a></h3> |
| 94 <p><a name="4.5_-_SSL/TLS_support" id="4.5_-_SSL/TLS_support">SSL/TLS support
including <em>AUTH, ADAT, PROT, PBSZ, CCC, MIC, CONF</em> and <em>ENC</em> comma
nds is a feature defined in </a><a href="http://www.faqs.org/rfcs/rfc2228.html"
rel="nofollow">RFC-2228</a>. There is no official support for SSL/TLS within th
e current code tree. The new Python 2.6 release finally grants full SSL support
so we hope we'll be able to implement the feature. Contributors willing to to
provide a patch are greatly appreciated. </p> |
| 95 <p> </p> |
| 96 </div> |
| 97 </body> |
| 98 </html> |
OLD | NEW |