README 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906
  1. .:. PURE-FTPD .:.
  2. Documentation for version 1.0.48
  3. ------------------------ BLURB ------------------------
  4. Pure-FTPd is a fast, production-quality, standard-conformant FTP server,
  5. based upon Troll-FTPd.
  6. The server has been designed to be secure in default configuration, it has no
  7. known vulnerability, it is really trivial to set up and it is especially
  8. designed for modern kernels. It was successfully ported to Linux, FreeBSD,
  9. Dragonfly BSD, NetBSD, OpenBSD, OSX, AIX and more.
  10. Features include chroot()ed and/or virtual chroot()ed home directories,
  11. virtual domains, built-in 'ls', anti-warez system, configurable ports for
  12. passive downloads, FXP protocol, bandwidth throttling, ratios,
  13. LDAP / MySQL / PostgreSQL-based authentication, fortune files, Apache-like
  14. log files, fast standalone mode, text / HTML / XML real-time status report,
  15. virtual users, virtual quotas, privilege separation, TLS and more.
  16. ------------------------ WHO'S USING IT? ------------------------
  17. Many people new to Unix are running Pure-FTPd because they find it easy to
  18. install. But that software is also used on embedded systems and highly loaded
  19. production servers, especially for hosting services.
  20. For large sites with centralized user management, Pure-FTPd provides flexible
  21. authentication schemes including SQL and LDAP backends, plus the ability to
  22. easily write new custom handlers in any language.
  23. ------------------------ COMPILATION ------------------------
  24. In its current form, Pure-FTPd uses some OS-specific system calls. And although
  25. some portability work has been done in order to ease its port to other
  26. operating systems, only Linux FreeBSD, NetBSD, OpenBSD, ISOS, MirBSD, BSDi,
  27. DragonflyBSD, Darwin, Solaris, Tru64, Irix, AIX and HPUX are known to work,
  28. other operating systems may need some tweaks. With Linux, any modern
  29. distribution should be ok.
  30. * Step 1 (optional but recommended):
  31. Create a specific, unprivileged user and group called _pure-ftpd, without any
  32. valid shell. Don't use this for anything else, including FTP virtual users.
  33. groupadd _pure-ftpd
  34. useradd -g _pure-ftpd -d /var/empty -s /etc _pure-ftpd
  35. If having a user whose name begins with an underscore is a no-go for you,
  36. you can also call it pure-ftpd, without the underscore.
  37. * Step 2:
  38. If you have Cdialog or Xdialog installed on your system, try the following
  39. command to build and install Pure-FTPd:
  40. make -f Makefile.gui
  41. If you don't have Cdialog or if you prefer the conventional way, here it is:
  42. ./configure
  43. make install-strip
  44. Et voila! The software is now installed in /usr/local/sbin/pure-ftpd
  45. * Step 3:
  46. To launch the server, just type the following command:
  47. /usr/local/sbin/pure-ftpd &
  48. If you installed a binary package (RPM, SLP, Debian), maybe use the
  49. following command instead:
  50. /usr/sbin/pure-ftpd &
  51. Your server is ready. Just type 'ftp localhost' to test it. If you want to
  52. automatically run the server when the system boots, add the previous command
  53. to /etc/rc.d/rc.local or /etc/rc.d/boot.local . Don't forget the '&' sign.
  54. Note:
  55. To deinstall Pure-FTPd (no, do you really want to do this?), use:
  56. ./configure
  57. make uninstall
  58. ------------------------ ADVANCED COMPILATION ------------------------
  59. The "./configure" script accepts some arguments you might want to add before
  60. the compilation:
  61. /--------------------
  62. "--with-" switches
  63. --------------------/
  64. --with-altlog: in addition to the syslog output, support logging into a
  65. specific file, in an alternative format. Currently, the CLF, Stats, W3C and
  66. xferlog formats are implemented.
  67. CLF (common log format) is the basic format produced by Apache, WebFS, Roxen
  68. and most web servers. These log files only record file transfers and they can
  69. feed web statistic software (Analog, Webalizer, etc.) to analyze the load of
  70. your FTP server. The Stats format is a special output format, designed for log
  71. file analysis software. The W3C format is a standard format parsed by most
  72. commercial log analyzers (all analyzers with support for IIS should deal with
  73. it) . Xferlog is the traditional format created by wu-ftpd. Check the -O
  74. option later in this documentation for additional info.
  75. --with-brokenrealpath: some Solaris versions have a broken realpath()
  76. implementation. If altlog and/or pure-uploadscript doesn't seem to work
  77. properly on your system, try to recompile with this switch.
  78. --with-tls: enable TLS support. Read README.TLS for more about this feature.
  79. --with-certfile=<file>: the file with the TLS certificate (see README.TLS). The
  80. default is /etc/ssl/private/pure-ftpd.pem .
  81. --with-cookie: display a fortune or a customized banner when a user logs
  82. in (see the '-F' option) .
  83. --with-diraliases: support directory aliases ("shortcuts" for the "cd"
  84. command) . Please read the appropriate section about this (further in this
  85. manual) .
  86. --with-everything: build a big server with almost all features turned on:
  87. altlog, cookies, throttling, ratios, ftpwho, upload script, virtual users
  88. (puredb), quotas, virtual hosts, directory aliases, external authentication,
  89. Bonjour and privilege separation.
  90. --with-extauth: compiles support for external authentication modules. Please
  91. read README.Authentication-Modules and the pure-authd(8) man page before
  92. enabling this feature. Most users don't need it.
  93. --with-ftpwho: support for the 'pure-ftpwho' command. Enabling this feature
  94. needs some extra memory. Better use it when the server is run in standalone
  95. mode. It can be way slower in inetd mode.
  96. --with-language=english
  97. --with-language=albanian
  98. --with-language=german
  99. --with-language=romanian
  100. --with-language=french
  101. --with-language=polish
  102. --with-language=spanish
  103. --with-language=danish
  104. --with-language=italian
  105. --with-language=brazilian-portuguese
  106. --with-language=slovak
  107. --with-language=dutch
  108. --with-language=korean
  109. --with-language=swedish
  110. --with-language=norwegian
  111. --with-language=russian
  112. --with-language=traditional-chinese
  113. --with-language=simplified-chinese
  114. --with-language=hungarian
  115. --with-language=catalan
  116. --with-language=czech: change the language of server messages.
  117. Default is english. If you want to contribute a translation, please
  118. translate the 'src/messages_en.h' file and send it to <j at pureftpd dot org> .
  119. --with-ldap: use the native LDAP directory support. When this option is
  120. enabled, system accounts can be bypassed. You need OpenLDAP to use that
  121. feature. If OpenLDAP is installed in a custom location, you can use the
  122. --with-ldap=<directory> syntax. See the README.LDAP file for more info about
  123. LDAP and Pure-FTPd.
  124. --with-minimal: to efficiently use features of modern FTP clients, Pure-FTPd
  125. implements the basics of the FTP protocol, with many extensions (SITE IDLE,
  126. SITE CHMOD, MLSD, ...) . Using the --with-minimal directive, these extensions
  127. won't be compiled in. Also, there will be no standalone server, no lookup for
  128. user/group names, no humor and no ASCII support. But the executable file size
  129. will be smaller than in a default installation. You need at least GCC 3.3 to
  130. compile with this option. Regular expressions are compiled in. If you still
  131. want to reduce the size, use --without-globbing in conjunction with
  132. --with-minimal. If you are building an embedded system, use this. In all other
  133. cases, to avoid complaints from customers (especially with Windows clients),
  134. forget this.
  135. --with-mysql: use the native MySQL support for users database. When this
  136. option is enabled, system accounts can be bypassed. MySQL client libraries
  137. should be installed to use that feature. If MySQL is installed in a custom
  138. location, you can use the --with-mysql=<directory> syntax. See the
  139. README.MySQL file for more info about MySQL and Pure-FTPd.
  140. --with-nonroot: set up a server that doesn't need root privileges to be
  141. started. Any regular user can run the server. It can be useful if you have a
  142. limited shell access to a non-dedicated hosting server. But some features
  143. will be disabled and passwords can only be checked via LDAP, SQL or PureDB.
  144. When virtual chroot is enabled, people will be restricted to the directory
  145. the server was started in. This is an insecure mode, designed for setting up
  146. very temporary servers by regular (non-root) users. Port 2121 will be
  147. listened by default in standalone mode. If you want to use the nonroot mode,
  148. you must compile and *install* the software (./configure --prefix=... &&
  149. make install-strip) . /sbin, /bin and /man directories will be created in
  150. that prefix. But you must also add an /etc directory (readable and writeable
  151. by the user pure-ftpd will run as) . You can change the anonymous FTP root
  152. directory through an environment variable named FTP_ANON_DIR.
  153. --with-pam: use pluggable authentication modules. Don't use this option
  154. if your login/passwd pairs are always refused (but the real fix would be to
  155. fix your PAM configuration). You need to create a /etc/pam.d/pure-ftpd file
  156. to properly use the PAM authentication. The 'pam' directory contains an
  157. example of such a file.
  158. --with-paranoidmsg: favor paranoid messages over sysadmin-friendly
  159. messages. When this option is enabled, login failures will show the same
  160. message to the user, regardless of the source of the problem. Without this
  161. option, "Authentication failure" is displayed when this is a password
  162. problem and "Sorry, I can't trust you" is displayed when the user has been
  163. banned by the sysadmin.
  164. --with-peruserlimits: enable per-user concurrency limits. Avoid this
  165. on very loaded servers.
  166. --with-pgsql: use the native Postgres support for users database. When this
  167. option is enabled, system accounts can be bypassed. Postgres client libraries
  168. should be installed to use that feature. If Postgres is installed in a custom
  169. location, you can use the --with-pgsql=<directory> syntax. See the
  170. README.PGSQL file for more info about Postgres and Pure-FTPd.
  171. --with-probe-random-dev: Pure-FTPd uses /dev/urandom or /dev/random devices
  172. to provide hardly-predicable random numbers. Presence of these devices are
  173. usually probed at compile-time. If you want to compile a binary package on
  174. a host, then run it on another host, this option will enable the probe at
  175. run-time. This is useless on Linux and BSD systems, but it can be needed on
  176. Solaris and QNX.
  177. --with-puredb: support virtual users, ie. a local users database,
  178. independent of your system accounts. Please read the README.Virtual-Users
  179. file for more info about virtual users.
  180. --with-quotas: enable virtual quotas. With virtual quotas, you can restrict
  181. the maximal number of files a user can store in his account. You can also
  182. of course restrict the total size. See the "quotas" section later in this
  183. document.
  184. --with-ratios: support upload/download ratios, to please w4r3z fr34k2.
  185. --with-sysquotas: support system quotas (not Pure-FTPd's virtual quotas) .
  186. --with-throttling: support bandwidth throttling (see below).
  187. --with-uploadscript: since 0.98, Pure-FTPd has a nice feature regarding
  188. uploads. Any external program or script can be automatically called after a
  189. successful upload. It needs another program installed by the Pure-FTPd
  190. package, called 'pure-uploadscript'. Check the man page for more info about
  191. this.
  192. --with-virtualchroot: usually, when a user is chrooted (-A and -a
  193. options), it's impossible to go out of his home directory. Enabling that
  194. feature makes it possible: symbolic links are always followed, even if they
  195. are pointing to directories not located in the user's home directory. This
  196. is very useful for having shared directories (for instance, have a symbolic
  197. link to /var/incoming in every home directory) .
  198. This feature isn't enabled by default.
  199. --with-virtualhosts: support virtual hosting. It means that you can have
  200. different anonymouns FTP areas for each IP address. If your server has only
  201. one IP address, you don't need that feature. But if you have multiple IP
  202. addresses and if you want a client that connects to IP xxx to get
  203. the content of /etc/pure-ftpd/xxx/ instead of ~ftp/ , enable this option.
  204. And read the the "VIRTUAL SERVERS" section at the end of this file.
  205. --with-welcomemsg: read 'welcome.msg' files for compatibility with some
  206. other FTP servers. This is a security flaw (anonymous users may upload
  207. 'welcome.msg' files to add random banners) . Pure-ftpd uses '.banner' files
  208. by default.
  209. --with-boring: display boring "professionnal-looking" messages.
  210. --with-bonjour: enable Bonjour support on MacOS X (see the -v switch).
  211. --with-rfc2640: enable support for charset conversion. It adds a dependency
  212. over the iconv library and it requires a little more CPU time. See the -8
  213. and -9 switches.
  214. --with-implicittls: build a FTPS server (TLS is implicitly enabled).
  215. The protocol is incompatible with FTP and listens to another port by default
  216. (port 990, ftps). Never enable this option unless you know what you're doing.
  217. /-----------------------
  218. "--without-" switches
  219. -----------------------/
  220. --without-privsep: disable privilege separation (see notes about this later),
  221. not recommended.
  222. --without-ascii: does not support 7-bits transfers (ASCII) . If you have
  223. customers using Windows clients to send scripts and HTML files, don't use
  224. this option or they will yell at you.
  225. --without-capabilities: if the capabilities library (libcap) is found,
  226. Pure-FTPd will try to use it in order to enhance security. This option
  227. overrides the test to ignore the library. Try this if capabilities don't
  228. work properly on your system. libcap can be downloaded from
  229. ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/ .
  230. --without-globbing: don't include the globbing code. It reduces the memory
  231. footprint but regular expressions won't work any more (things like 'ls
  232. *.rpm') . Most people shouldn't use --without-globbing. Globbing is a nice
  233. feature.
  234. --without-humor: if you find what this option does without peeking at the
  235. source code, you're a lucky guy!
  236. --without-inetd: if you will always be running Pure-FTPd in standalone-mode,
  237. enabling this flag can save a few code bytes. Don't enable --without-inetd
  238. and --without-standalone, because it's impossible to run a server without
  239. one of them. These options aren't enabled on binary distributions of
  240. Pure-FTPd, so that both inetd-like and standalone mode are supported.
  241. --without-iplogging: don't log any IP address to protect confidentiality,
  242. especially for political servers.
  243. --without-nonalnum: paranoid file name checking: only allow basic
  244. alphanumeric characters. Never enable this switch blindly, or your customers
  245. will complain.
  246. --without-unicode: disallow non-latin characters. Recommended if you don't
  247. have special characters in file names.
  248. --without-sendfile: on Linux, Solaris, HPUX and FreeBSD kernels, Pure-FTPd
  249. tries to reduce the CPU/memory usage by using a special system call (sendfile)
  250. . It works very well with most filesystems. However, this optimization is not
  251. implemented for all filesystems in current kernels. Users reported that
  252. downloading files with Pure-FTPd failed with SMBFS (Samba) on FreeBSD and
  253. TmpFS and NTFS on Linux (the error reported by the server is "broken pipe" or
  254. "Error during write to data connection") . If you are planning to serve files
  255. from these filesystems, you have to use the --without-sendfile switch to
  256. enable a workaround. It was also reported that PA-Risc Linux systems need this
  257. flag.
  258. --without-shadow: ignore the shadow passwords, even though they are
  259. auto-detected. Usually a bad idea, unless you use PAM, LDAP or SQL.
  260. Pure-FTPd support expiration dates of shadow passwords (both for accounts
  261. and passwords) .
  262. --without-standalone: the FTP server can normally run in standalone-mode
  263. (without any super-server) . If you don't need that feature and if you want
  264. to save few code bytes, add this option. A super-server such as xinetd
  265. or tcpserver will be mandatory to run the service. But the standalone mode is
  266. the recommended mode of operation.
  267. --without-usernames: never outputs user and group names in directory
  268. listings, only UIDs and GIDs. It improves security and performances, but
  269. some people find this not user-friendly.
  270. /--------------
  271. Other notes
  272. --------------/
  273. Other traditional autoconf options are of course recognised, in particular:
  274. - "--prefix=" to change the installation prefix, that defaults to "/usr/local/"
  275. - "--sysconfdir=" to change the configuration files directory (defaults to
  276. "/etc" unless you specified a prefix with --prefix)
  277. - "--localstatedir=" to change the runtime files directory (defaults to
  278. "/var" even if you specified a prefix with --prefix)
  279. FYI, the binary RPM packages of Pure-FTPd are configured with the following
  280. command line:
  281. ./configure --with-everything --with-paranoidmsg --without-capabilities \
  282. --with-virtualchroot
  283. RPM packages are also compiled with --without-pam to enhance their
  284. portability.
  285. ------------------------ STANDALONE INSTALLATION ------------------------
  286. This is the recommended way to start the server.
  287. Unless you compiled the server with "--without-standalone", running the
  288. server is as easy as typing:
  289. /usr/local/sbin/pure-ftpd &
  290. In the following examples, we will assume that the 'pure-ftpd' file is
  291. located in /usr/local/sbin. This is the default if you compiled the server
  292. from the source code tarball. But as I said earlier in this document, if
  293. you installed a binary package (RPM, SLP, DEB, TGZ), the server maybe
  294. installed in /usr/sbin/. So just replace '/usr/local/sbin/pure-ftpd' with
  295. '/usr/sbin/pure-ftpd'.
  296. When the previous command is run, the server will listen for incoming
  297. connections on every interface, all IP addresses and the standard FTP port
  298. (21) . If your system has IPv6 addresses, they should work as well.
  299. Now, if you want to listen for an incoming connection on a non-standard port,
  300. just append '-S' and the port number:
  301. /usr/local/sbin/pure-ftpd -S 42
  302. Service names are also allowed ('-S smtp' and the daemon will be accepting
  303. connections on the SMTP port (25) . Very uncommon, but we should please
  304. everybody anyway, even disturbed minds) .
  305. Now, what if your system has many IP addresses and you want the FTP server
  306. to be reachable on only one of these addresses, let's say 192.168.0.42?
  307. Just use the following command line:
  308. /usr/local/sbin/pure-ftpd -S 192.168.0.42,
  309. The final comma is important, don't forget it. Actually, it's a shorthand for:
  310. /usr/local/sbin/pure-ftpd -S 192.168.0.42,21
  311. If you prefer host names over IP addresses, it's your choice:
  312. /usr/local/sbin/pure-ftpd -S ftp.example.com,21
  313. IPv6 addresses are of course supported.
  314. With previous command lines, the server will run in the default
  315. configuration. Anonymous FTP logins will be allowed if there's a system
  316. account called 'ftp' and every user of your system will be able to access
  317. the FTP server using their regular login/password pair.
  318. If you need to tweak that default configuration, other command-lines options
  319. can be added. For instance:
  320. /usr/local/sbin/pure-ftpd -c 50 &
  321. or
  322. /usr/local/sbin/pure-ftpd -S ftp.example.com,21 -c 50 &
  323. And only 50 simultaneous connections will be allowed. To discover what
  324. options are available please jump to the 'OPTIONS' chapter below. If the
  325. server runs perfectly for you in standalone mode, you don't need to read the
  326. following chapter about super-servers. But read the options. '-m' and '-C'
  327. are recommended. '-D' is also a good choice if you (or your customers) use
  328. broken clients. Please read on.
  329. When you run 'ps auxw|grep pure-ftpd', the result looks like this:
  330. root 15211 0.1 0.3 1276 452 ? S 13:53 0:00 pure-ftpd [SERVER]
  331. root 15212 0.1 0.5 1340 672 ? S 13:54 0:00 pure-ftpd [IDLE]
  332. root 15214 0.0 0.5 1340 672 ? S 13:56 0:00 pure-ftpd [DOWNLOADING]
  333. [SERVER] is the main server. If you kill this process, the server will exit
  334. after the next connection.
  335. [IDLE] shows a client with no transfer activity.
  336. [DOWNLOADING] shows a client downloading a file.
  337. [UPLOADING] show a client uploading a file.
  338. For easy scripting, the file '/var/run/pure-ftpd.pid' is created and it
  339. always contains the PID of the main server process.
  340. If you want to stop the server, you can just kill the processes:
  341. pkill -x pure-ftpd
  342. Of course, don't use -9 unless the server is completely stuck. -9 doesn't
  343. let processes any chance to clean things up and should never be used except
  344. where there's absolutely nothing else to do.
  345. ------------------------ SUPER-SERVER INSTALLATION ------------------------
  346. Pure-FTPd can also run with the help of a super-server, like telnet, wu-ftp,
  347. finger or Qmail. This is not recommended. If this is an option, start it in
  348. standalone mode instead. Using a super-server is usually slower than the
  349. standalone mode. But if you love tcpwrappers or built-in filtering abilities
  350. of your super-server, Pure-FTPd can cope with them.
  351. Unix has tons of super-servers: Inetd (the most common one), TCPserver,
  352. G2S, Xinetd, Rlinetd, ... Only the first three will be covered here, but
  353. integration with other super-servers should be painless.
  354. **** Usage with Inetd ****
  355. Important: if security matters for you, forget inetd. In the default
  356. configuration, inetd will stop a service after a high rate of connections to
  357. the same port. This creates an easy denial-of-service. Also, inetd doesn't
  358. have any concurrency limit. Bad guys can fill up your memory and your
  359. descriptor tables even if you are restricting the number of connections in
  360. pure-ftpd. Better use a modern replacement for inetd, or run pure-ftpd in
  361. standalone mode.
  362. 1) Check that inetd is up:
  363. ps auxw | grep inetd
  364. root 3699 0.0 0.3 1072 492 ? S 15:47 0:00 inetd
  365. 2) Edit /etc/inetd.conf and look for a line like:
  366. ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd
  367. The line may also end with "proftpd" or "wuftpd", but it should start with
  368. "ftp stream tcp".
  369. 3) Replace that line with the following one:
  370. ftp stream tcp nowait root /usr/sbin/tcpd /usr/local/sbin/pure-ftpd
  371. If /usr/sbin/tcpd is missing on your system, try the following line instead:
  372. ftp stream tcp nowait root /usr/local/sbin/pure-ftpd pure-ftpd
  373. 4) Restart the inetd daemon:
  374. pkill -x -s HUP inetd
  375. If 'pkill' is missing on your system, try this:
  376. kill -HUP $(cat /var/run/inetd.pid)
  377. **** Usage with Xinetd ****
  378. Add the following entry to the /etc/xinetd.conf file:
  379. service ftp
  380. {
  381. socket_type = stream
  382. server = /usr/local/sbin/pure-ftpd
  383. protocol = tcp
  384. user = root
  385. wait = no
  386. disable = no
  387. }
  388. On Redhat systems, you can also put this in a /etc/xinetd.d/pure-ftpd file.
  389. Then, restart the server:
  390. pkill -x -s USR2 xinetd
  391. **** Usage with TCPserver ****
  392. TCPServer is part of the ucspi-tcp package by Dan Bernstein.
  393. The simplest way of running Pure-FTPd with TCPserver is the following command:
  394. tcpserver -DHRl0 0 21 /usr/local/bin/pure-ftpd &
  395. You can add that line to your system local startup scripts
  396. (usually /etc/rc.d/boot.local or /etc/rc.d/rc.local) . If it doesn't work,
  397. replace 'tcpserver' with its full path (eg. '/usr/local/bin/tcpserver') .
  398. ------------------------ OPTIONS ------------------------
  399. The previous steps should be enough to get a running FTP server. But you can
  400. add some command-line arguments to change its behavior. These arguments have
  401. to be added after the pure-ftpd path in your super-server configuration.
  402. For instance, you want to add the '-s' and '-a 42' flags. Here are what the
  403. configuration lines will look like in your super-server:
  404. - Inetd:
  405. ftp stream tcp nowait root /usr/sbin/tcpd /usr/local/sbin/pure-ftpd -s -a42
  406. or
  407. ftp stream tcp nowait root /usr/local/sbin/pure-ftpd pure-ftpd -s -a42
  408. If you use Inetd, don't put space between options and arguments. e.g. use
  409. -a42 instead of -a 42 . Inetd has trouble dealing with a lot of options and
  410. with characters like ':' .
  411. - Xinetd:
  412. service ftp
  413. {
  414. socket_type = stream
  415. server = /usr/local/sbin/pure-ftpd
  416. server_args = -s -a 42
  417. protocol = tcp
  418. user = root
  419. wait = no
  420. disable = no
  421. }
  422. - TCPserver:
  423. tcpserver -DHRl0 0 21 /usr/local/bin/pure-ftpd -s -a 42 &
  424. - G2S:
  425. {
  426. SERVICE ftp
  427. DESCRIPTION "Pure-FTPd"
  428. RUN /usr/local/sbin/pure-ftpd -s -a 42
  429. }
  430. Users need a shell listed in /etc/shells to get restricted or unrestricted
  431. FTP access. Alternatively, you can give them "ftp" as a shell. Users with a
  432. "ftp" shell will be able to login through FTP only: no telnet, no SSH. And
  433. there's no need (and you shouldn't do so) for an "ftp" entry in /etc/shells.
  434. Here are the recognized switches:
  435. - '-0': when a file is uploaded and there is already a previous version of the
  436. file with the same name, the old file will neither get removed nor truncated.
  437. Upload will take place in a temporary file and once the upload is complete,
  438. the switch to the new version will be atomic. For instance, when a large PHP
  439. script is being uploaded, the web server will still serve the old version and
  440. immediately switch to the new one as soon as the full file will have been
  441. transferred.
  442. - '-1': log the PID of each session in syslog output.
  443. - '-2 <file>': when using TLS, set the path to the certificate file.
  444. - '-4': only listen to IPv4 connections.
  445. - '-6': don't listen to IPv4, only listen to IPv6.
  446. - '-a <gid>': authenticated users will be granted access to their home
  447. directory and nothing else (chroot) . This is especially useful for users
  448. without shell access, for instance, WWW-hosting services shared by several
  449. customers. Only member of group number <gid> will have unrestricted access
  450. to the whole filesystem. So add a "staff", "admin" or "ftpadmin" group and
  451. put your trusted users in. <gid> is a NUMERIC group number, not a group name.
  452. This feature is mainly designed for system users, not for virtual ones.
  453. Note: 'root' (uid 0) always has full filesystem access.
  454. If you want to chroot() everyone, but root, use the following flag:
  455. - '-A': chroot() everyone, but root. There's no such thing as a trusted
  456. group. '-A' and '-a <gid>' are mutually exclusive.
  457. - '-b': Ignore parts of RFC standards in order to deal with some totally
  458. broken FTP clients, or broken firewalls/NAT boxes. Also, non-dangling
  459. symbolic links are shown as real files/directories.
  460. - '-B': Have the standalone server start in background (daemonization).
  461. - '-c <number of clients>': Allow a maximum of clients to be connected. For
  462. instance '-c 42' will limit access to simultaneous 42 clients. There is a
  463. 50 client limit by default.
  464. - '-C <max connection per ip>': Limit the number of simultaneous connections
  465. coming from the same IP address. This is yet another very effective way to
  466. prevent stupid denial of services and bandwidth starvation by a single user.
  467. It works only when the server is launched in standalone mode (if you use a
  468. super-server, it is supposed to do that) . If the server is launched with
  469. '-C 2', it doesn't mean that the total number of connections is limited to 2.
  470. But the same client, coming from the same machine (or at least the same IP),
  471. can't have more than two simultaneous connections. This feature needs some
  472. memory to track IP addresses, but it's recommended to use it.
  473. - '-d': Send various debugging messages to the syslog. Don't use this
  474. unless you really want to debug Pure-FTPd. Passwords aren't logged.
  475. Duplicate '-d' to log responses, too.
  476. - '-D': List files beginning with a dot ('.') even when the client doesn't
  477. append the '-a' option to the list command. A workaround for badly
  478. configured FTP clients. If you are a purist, don't enable this. If you
  479. provide hosting services and if you have lousy customers, enable this.
  480. - '-e': Only allow anonymous users. Use this on a public FTP site with no
  481. remote FTP access to real accounts.
  482. - '-E': Only allow authenticated users. Anonymous logins are prohibited.
  483. - '-f <facility>': Use that facility for syslog logging. It defaults to
  484. 'ftp' (or 'local2' if you got an obsolete libc without that facility).
  485. Logging can be disabled with '-f none' .
  486. - '-F <fortune file>': Display a fortune cookie on login. The sentence is
  487. a random extract from the text file <fortune file>. This text file should be
  488. formatted like standard "fortune" files (fortunes are separated by a '%'
  489. sign on a single line) . Pure-FTPd has to be compiled with support for
  490. cookies (--with-cookie). If you just want a simple banner displayed before
  491. the login prompt, add the name of any text file here.
  492. - '-g <pid file>': Change the location of the pid file when the server is
  493. run in standalone mode. The default is /var/run/pure-ftpd.pid .
  494. - '-G': Disallow renaming.
  495. - '-H': By default, fully-qualified host names are logged. To achieve this,
  496. DNS lookups are mandatory. The '-H' flag avoids host names resolution.
  497. ("213.41.14.252" will be logged instead of "www.toolinux.com") . It can
  498. significantly speed up connections and reduce bandwidth usage on busy
  499. servers. Use it especially on public FTP sites. Also, please note that
  500. without -H, host names are informative but shouldn't be trusted: no reverse
  501. mapping check is done to save DNS queries.
  502. - '-i': Disallow upload for anonymous users, whatever directory permissions
  503. are. This option is especially useful for virtual hosting, to avoid your
  504. users creating warez sites in their account.
  505. - '-I <timeout>': Change the maximum idle time. The timeout is in minutes
  506. and defaults to 15 minutes. Modern FTP clients are trying to fool timeouts
  507. by sending fake commands at regular interval. We disconnect these clients
  508. when they are idle for twice (because they are active anyway) the normal
  509. timeout.
  510. - '-j': If the home directory of a user doesn't exist, automatically create
  511. it. The newly created home directory belongs to the user and permissions are
  512. set according to the current directory mask. Only the home directory can be
  513. created (so /home/john/./public_html won't work, but /home/john will) . To
  514. avoid local attacks, the parent directory should never belong to an untrusted
  515. user. Also note that you must trust whoever manages the users databases,
  516. because with that feature, he'll be able to create/chown directories anywhere
  517. on the server's filesystem.
  518. - '-J <ciphers>': Sets the list of ciphers that will be accepted for
  519. TLS connections.
  520. - '-k <percentage>': Don't allow uploads if the partition is more than
  521. <percentage>% full. For instance, "-k 95" will ensure your disks will never
  522. get filled more than 95% by FTP. No need for the "percent" sign after the
  523. number.
  524. - '-K': Allow users to resume and upload files, but *NOT* to delete or rename
  525. them. Directories can be removed, but only if they are empty. However,
  526. overwriting existing files is still allowed (to support upload resume) . If
  527. you want to disable this too, add -r (--autorename) .
  528. - '-l <authentication>' or '-l <authentication>:<config file>': Adds a new
  529. rule to the authentication chain. Please read the "Authentication" section,
  530. later in this README file. It's an important section.
  531. - '-L <max files>:<max depth>': To avoid stupid denial-of-service attacks
  532. (or just CPU hogs), Pure-FTPd never displays more than 10000 files in response
  533. to an 'ls' command. Also, a recursive 'ls' (-R) never goes further than 5
  534. subdirectories. You can increase/decrease those limits with the '-L' option.
  535. - '-m <cpu load>': Don't allow anonymous download if the load is above <cpu
  536. load> . A very efficient way to prevent overloading your server. Upload is
  537. still allowed, though.
  538. - '-M': Allow anonymous users to create directories.
  539. - '-n <max files>:<max size>': If the server has been compiled with support
  540. for virtual quotas, enforce these quota settings for all users (except
  541. members of the 'trusted' group) . <max size> is in Megabytes. See the
  542. "virtual quotas" section later in this document.
  543. - '-N': NAT mode. Force ACTIVE mode. If your FTP server is behind a NAT box
  544. that doesn't support applicative FTP proxying, or if you use port
  545. redirection without a transparent FTP proxy, use this. Well... the previous
  546. sentence isn't very clear. Okay: if your network looks like this:
  547. (FTP server)-------(NAT/masquerading gateway/router)------(Internet)
  548. and if you want people coming from the internet to have access to your FTP
  549. server, please try without this option first. If Netscape clients can
  550. connect without any problem, your NAT gateway rulez. If Netscape doesn't
  551. display directory listings, your NAT gateway sucks. Use '-N' as a workaround.
  552. - '-o': Write all uploaded files to '/var/run/pure-ftpd.upload.pipe' so
  553. that the 'pure-uploadscript' program can run. Don't enable that option if
  554. you don't actually use 'pure-uploadscript' otherwise pure-ftpd will hang
  555. waiting for pure-uploadscript to start.
  556. - '-O <format>:<log file>': Record all file transfers into a specific log
  557. file, in an alternative format. Currently, four formats are supported: CLF
  558. (Apache-like), Stats, W3C and xferlog.
  559. If you add '-O clf:/var/log/pureftpd.log' to your starting options,
  560. Pure-FTPd will log transfers in /var/log/pureftpd.log in a format similar to
  561. the Apache web server in default configuration.
  562. If you use '-O stats:/var/log/pureftpd.log' to your starting options,
  563. Pure-FTPd will create log files in a special format, designed for statistical
  564. reports. The Stats format is compact, more efficient and more accurate that
  565. CLF and the old broken "xferlog" format.
  566. The Stats format is:
  567. <date> <session id> <user> <ip> <U or D> <size> <duration> <file>
  568. <date> is a GMT timestamp (time()) and <session id> identifies the current
  569. session. <file> is unquoted, but it's always the last element of a log line.
  570. "U" means "Upload" and "D" means "Download".
  571. Warning: the session id is only designed for statistics purposes. While it's
  572. always an unique string in the real world, it's theoretically possible to have
  573. it non unique in very rare conditions. So don't rely on it for critical
  574. missions.
  575. A command called "pure-statsdecode" can be used to convert timestamps into
  576. human-readable dates.
  577. The W3C format is enabled with '-O w3c:/var/log/pureftpd.log' .
  578. For security purposes, the path must be absolute (eg. /var/log/pureftpd.log
  579. , not ../log/pureftpd.log) . If this log file is stored on a NFS volume, don't
  580. forget to start the lock manager (often called "lockd" or "rpc.lockd").
  581. - '-p <first port>:<last port>': Use only ports in the range <first port>
  582. to <last port> inclusive for passive-mode downloads. This is especially
  583. useful if the server is behind a firewall without FTP connection tracking.
  584. Use high ports (40000-50000 for instance), where no regular server should be
  585. listening.
  586. - '-P <ip address or host name>': Force the specified IP address in reply to
  587. a PASV/EPSV/SPSV command. If the server is behind a masquerading (NAT) box
  588. that doesn't properly handle stateful FTP masquerading, put the ip address
  589. of that box here. If you have a dynamic IP address, you can put the public
  590. host name of your gateway, that will be resolved every time a new client will
  591. connect.
  592. - '-q <upload ratio>:<download ratio>': Enable ratios for anonymous users.
  593. - '-Q <upload ratio>:<download ratio>': Enable ratios for everybody
  594. (anonymous and non-anonymous). Members of the root (0, something called
  595. 'wheel') have no ratio.
  596. - '-r': Never overwrite existing files. Uploading a file whose name
  597. already exists cause an automatic rename. Files are called xyz, xyz.1, xyz.2,
  598. xyz.3, etc.
  599. Tip: if you compile with 'make AUTORENAME_REVERSE_ORDER=1' , the naming
  600. convention will be reversed. Files will be called xyz, 1.xyz, 2.xyz, 3.xyz,
  601. etc.
  602. - '-R': Disallow users (even non-anonymous ones) usage of the CHMOD
  603. command. On hosting services, it may prevent newbies from making mistakes,
  604. like setting bad permissions on their home directory. Only root can use
  605. CHMOD when -R is enabled.
  606. - '-s': The "waReZ protection". Don't allow anonymous users to download
  607. files owned by "ftp" (generally, files uploaded by other anonymous users) .
  608. So that uploads have to be validated by a system administrator (chown to
  609. another user) before being available for download.
  610. - '-S [<ip address>,|<hostname>,] [<port>|<service name>]'. This option is
  611. only effective when the server is launched as a standalone server.
  612. Connections are accepted on the specified IP and port. IPv4 and IPv6 are
  613. supported. Numeric and fully-qualified host names are accepted. A service
  614. name (see /etc/services) can be used instead of a numeric port number.
  615. - '-T <bandwidth>' and '-t <bandwidth>': Enable bandwidth limitation (see
  616. below) . <bandwidth> is specified in kilobytes/seconds. To set up separate
  617. upload/download bandwidth, the [<upload>]:[<download>] syntax is supported.
  618. - '-u <uid>': Don't allow uids below <uid> to log in. '-u 1' denies access
  619. to root (safe), '-u 100' denies access to virtual accounts on most Linux
  620. distros.
  621. - '-U <umask for files>:<umask for dirs>': Change the file creation mask.
  622. The default is 133:022. If you want a new file uploaded by a user to only be
  623. readable by that user, use '-U 177:077'. If you want uploaded files to be
  624. executable, use 022:022 (files will be readable -but not writable- by other
  625. users) or 077:077 (files will only be executable and readable by their
  626. owner) . Please note that Pure-FTPd support the SITE CHMOD extension, so a
  627. user can change the permissions of his own files.
  628. - '-V <ip address>': Allow non-anonymous FTP access only on this specific
  629. local IP address. All other IP addresses are only anonymous. With that
  630. option, you can have routed IPs for public access and a local IP (like
  631. 10.x.x.x) for administration. You can also have a routable trusted IP
  632. protected by firewall rules and only that IP can be used to login as a
  633. non-anonymous user.
  634. - '-v <name>': Set the service name for Apple's Bonjour. Only available on
  635. MacOS X when Bonjour support is compiled in.
  636. - '-w': Support the FXP protocol only for authenticated users. FXP works
  637. with IPv4 and IPv6 addresses.
  638. - '-W': Support the FXP protocol. FXP allows transfers between two remote
  639. servers without any file data going to the client asking for the transfer.
  640. However:
  641. ****************************************************************************
  642. *FXP IS AN INSECURE PROTOCOL* (third-party hosts can steal the current
  643. connection) . In Pure-FTPd, specific precautions have been taken to reduce
  644. FXP insertion attacks. But if your FTP server serves private data:
  645. NEVER ALLOW FXP ACCESS TO UNTRUSTED HOSTS. YOU CAN PLAY WITH IT ON AN
  646. INTERNAL SERVER, BUT _DON'T_ GIVE FXP ACCESS TO ANONYMOUS INTERNET USERS.
  647. ****************************************************************************
  648. It's why FXP is disabled by default on Pure-FTPd unless you
  649. explicitly enable it with '-W' or '-w'.
  650. - '-x': In normal operation mode, authenticated users can read/write files
  651. beginning with a dot ('.') . Anonymous users can't, for security reasons
  652. (like changing banners or a forgotten .rhosts) . When '-x' is used,
  653. authenticated users can download dot-files, but not overwrite/create them,
  654. even if they own them. That way, you can prevent hosted users from messing
  655. .qmail files. If you want to give user access to a special dot-file, create a
  656. symbolic link to the dot-file with a file name that has no dot in it and the
  657. client will be able to retrieve the file through that link.
  658. - '-X': This flag is identical to the previous one (writing dot-files is
  659. prohibited), but in addition, users can't even *read* files and directories
  660. beginning with a dot (like "cd .ssh") .
  661. ****************************************************************************
  662. When used in conjunction with "-a", members of the trusted group can bypass
  663. '-x'/'-X' restrictions.
  664. ****************************************************************************
  665. - '-y <max user logins>:<max anonymous logins>': This option only
  666. works if the server has been compiled with --with-peruserlimits. It
  667. restricts the number of concurrent sessions the same user can have.
  668. A null value ('0') means 'unlimited'.
  669. Here's a concrete example:
  670. /usr/local/sbin/pure-ftpd -y 3:20 -c 15 -C 5 -B
  671. Here, we allow:
  672. * A max total of 15 sessions.
  673. * 5 connections max coming from the same IP address.
  674. * 3 connections max with the same user name.
  675. * 20 anonymous users max.
  676. With such a setup, a single user can't easily fill all slots.
  677. - '-Y 0': Disable the TLS encryption layer (default).
  678. '-Y 1': Accept both standard and encrypted sessions.
  679. '-Y 2': Refuse connections that aren't using TLS security mechanisms,
  680. including anonymous sessions. The server must have been compiled with
  681. --with-tls and a valid certificate must be in place to get this feature.
  682. See the README.TLS file for more info about TLS.
  683. '-Y 3': Cleartext sessions are refused and only TLS compatible
  684. clients are accepted. Clear data connections are also refused, so private
  685. data connections are enforced.
  686. - '-z': Allow anonymous users to read files and directories starting with a
  687. dot ('.') .
  688. - '-Z': Try to protect customers against common mistakes to avoid your
  689. technical support being busy with stupid issues. Right now, the '-Z' switch
  690. prevents your users against making bad 'chmod' commands, that would deny
  691. access to files/directories to themselves. The switch may turn on other
  692. features in the future. If you are a hosting provider, turn this on.
  693. If you prefer long options (GNU-style) over standard ones, the following
  694. aliases are available. You can get this list at any time by typing
  695. 'pure-ftpd --help' .
  696. --(switches sorted by ##standard switches## lexical order)--
  697. -0 --notruncate
  698. -1 --logpid <file>
  699. -4 --ipv4only
  700. -6 --ipv6only
  701. -8 --fscharset <charset>
  702. -9 --clientcharset <charset>
  703. -a --trustedgid <gid>
  704. -A --chrooteveryone
  705. -b --brokenclientscompatibility
  706. -B --daemonize
  707. -c --maxclientsnumber <number>
  708. -C --maxclientsperip <number>
  709. -d --verboselog
  710. -D --displaydotfiles
  711. -e --anonymousonly
  712. -E --noanonymous
  713. -f --syslogfacility <facility>
  714. -F --fortunesfile <file>
  715. -g --pidfile <path to pid file>
  716. -G --norename
  717. -h --help
  718. -H --dontresolve
  719. -i --anonymouscantupload
  720. -I --maxidletime <time (min)>
  721. -j --createhomedir
  722. -J --tlsciphersuite <ciphers>
  723. -k --maxdiskusagepct <percentage>
  724. -K --keepallfiles
  725. -l --login <auth> or <auth>:<config file>
  726. -L --limitrecursion <number:number>
  727. -m --maxload <load>
  728. -M --anonymouscancreatedirs
  729. -N --natmode
  730. -o --uploadscript
  731. -O --altlog <format>:<log file>
  732. -p --passiveportrange <minport:maxport>
  733. -P --forcepassiveip <ip address>
  734. -q --anonymousratio <upload ratio>:<download ratio>
  735. -Q --userratio <upload ratio>:<download ratio>
  736. -r --autorename
  737. -R --nochmod
  738. -s --antiwarez
  739. -S --bind <ip address,port>
  740. -t --anonymousbandwidth <bandwidth (KB/s)>
  741. -T --userbandwidth <bandwidth (KB/s)> or [<up bw>]:[<down bw>]
  742. -u --minuid <uid>
  743. -U --umask <mask>
  744. -v --bonjour <name>
  745. -V --trustedip <ip address>
  746. -w --allowuserfxp
  747. -W --allowanonymousfxp
  748. -x --prohibitdotfileswrite
  749. -X --prohibitdotfilesread
  750. -y --peruserlimits <per user max>:<max anonymous sessions>
  751. -Y --tls <0:no TLS | 1:TLS+cleartext | 2:enforce TLS |
  752. 3: enforce encrypted data channel as well>
  753. -z --allowdotfiles
  754. -Z --customerproof
  755. --(switches sorted by ##GNU-style long switches## lexical order)--
  756. -W --allowanonymousfxp
  757. -z --allowdotfiles
  758. -w --allowuserfxp
  759. -O --altlog <format>:<log file>
  760. -t --anonymousbandwidth <bandwidth (KB/s)>
  761. -M --anonymouscancreatedirs
  762. -i --anonymouscantupload
  763. -e --anonymousonly
  764. -q --anonymousratio <upload ratio>:<download ratio>
  765. -s --antiwarez
  766. -r --autorename
  767. -S --bind <ip address,port>
  768. -b --brokenclientscompatibility
  769. -A --chrooteveryone
  770. -9 --clientcharset <charset>
  771. -j --createhomedir
  772. -Z --customerproof
  773. -B --daemonize
  774. -D --displaydotfiles
  775. -H --dontresolve
  776. -Y --tls <0:no TLS | 1:TLS+cleartext | 2:enforce TLS |
  777. 3:enforce encrypted data channel as well>
  778. -P --forcepassiveip <ip address>
  779. -F --fortunesfile <file>
  780. -8 --fscharset <charset>
  781. -h --help
  782. -4 --ipv4only
  783. -6 --ipv6only
  784. -K --keepallfiles
  785. -l --login <auth> or <auth>:<config file>
  786. -1 --logpid <file>
  787. -L --limitrecursion <number:number>
  788. -c --maxclientsnumber <number>
  789. -C --maxclientsperip <number>
  790. -k --maxdiskusagepct <percentage>
  791. -I --maxidletime <time (min)>
  792. -m --maxload <load>
  793. -u --minuid <uid>
  794. -N --natmode
  795. -E --noanonymous
  796. -R --nochmod
  797. -G --norename
  798. -0 --notruncate
  799. -v --bonjour <name>
  800. -p --passiveportrange <minport:maxport>
  801. -y --peruserlimits <per user max>:<max anonymous sessions>
  802. -g --pidfile <path to pid file>
  803. -X --prohibitdotfilesread
  804. -x --prohibitdotfileswrite
  805. -f --syslogfacility <facility>
  806. -J --tlsciphersuite <ciphers>
  807. -a --trustedgid <gid>
  808. -V --trustedip <ip address>
  809. -U --umask <mask>
  810. -o --uploadscript
  811. -T --userbandwidth <bandwidth (KB/s)> or [<up bw>]:[<down bw>]
  812. -Q --userratio <upload ratio>:<download ratio>
  813. -d --verboselog
  814. ------------------------ SETTING UP AN ANONYMOUS FTP ------------------------
  815. If a 'ftp' user exists and its home directory exists, Pure-FTPd will
  816. accept anonymous login, as 'ftp' or 'anonymous'.
  817. The root directory of the files served when logged as 'anonymous' is
  818. the home directory of the 'ftp' user.
  819. There's no need for 'bin', 'lib', 'etc' and 'dev' directories, nor any
  820. external program. Don't chown the public files to 'ftp', just writable
  821. directories such as 'incoming'.
  822. ------------------------ DISPLAYING BANNERS ------------------------
  823. If a '.banner' file is located in the 'ftp' user home directory (or in the
  824. root directory of a virtual server, see below), it will be printed when the
  825. client logs in. Put a nice ASCII-art logo with your name in that file.
  826. This file shouldn't be larger than 4000 bytes, or it won't be displayed.
  827. In each directory, you may also have a '.message' file. Its content will be
  828. printed when a client enters the directory. Such a file can contain important
  829. information ("Don't download version 1.7, it's broken!") .
  830. ------------------------ DISPLAYING A COOKIE ------------------------
  831. A funny random message can be displayed in the initial login banner. The
  832. random cookies are extracted from a text file, in the standard "fortune"
  833. format. If you installed the "fortune" package, you should have a directory
  834. (usually /usr/share/fortune) with binary files (xxxx.dat) and text files
  835. (without the .dat extension) . To use Pure-FTPd cookies, just add the name
  836. of a text file to the '-F' option. For instance:
  837. /usr/local/sbin/pure-ftpd -F /usr/share/fortune/zippy
  838. If you want to have your own fortune files, just create a text file with the
  839. following structure.
  840. Hello... this is the first fortune...
  841. %
  842. Welcome to the real world.
  843. %
  844. Follow the white rabbit.
  845. %
  846. Have fun...
  847. Well... lotsa fun!
  848. %
  849. Yop is good for you.
  850. Goddit? Fortunes are delimited by a '%' sign on a single line. But a
  851. fortune itself can be multi-line (see the fourth example) .
  852. For security paranoia, the text file has to be readable by everybody (chmod
  853. 644 the file if necessary), or the server will ignore it.
  854. Of course, the fortune file can contain a single message.
  855. ------------------------ PER-USER CHROOT() RULES ------------------------
  856. Apart from the "-a" flag, Pure-FTPd has another way to fine-tune chroot()
  857. rules. Let's take an /etc/passwd entry:
  858. mimi:x:501:100:Mimi:/home/mimi:/bin/zsh
  859. Without any special rule, mimi will be able to log in and to retrieve any
  860. public-readable file in the filesystem. Now, let's change a bit of its home
  861. directory:
  862. mimi:x:501:100:Mimi:/home/mimi/./:/bin/zsh
  863. So what? Mimi's home directory is still the same and common applications
  864. shouldn't notice any difference. But Pure-FTPd understands "chroot() until
  865. /./". So when mimi next carries out a FTP log in, only the /home/mimi
  866. directory will be reachable, not the whole filesystem. If you don't like the
  867. "-a" and its trusted gid thing, this is a good way to only chroot() some
  868. users. Another trick is to add something after "/./":
  869. mimi:x:501:100:Mimi:/home/mimi/./public_html:/bin/zsh
  870. When Mimi will log in, two things will happen:
  871. - chroot("/home/mimi") so that Mimi can't see anything but her home directory.
  872. - chdir("public_html") so the session will start in the public_html
  873. directory. "cd .." is still allowed, though.
  874. That "url-style" handling is especially handy for FTP-only users (ie.
  875. without shell access) .
  876. If a user is chrooted with the /./ trick *and* belongs to the trusted group
  877. (-a) he *will* be chrooted, but he will have no ratio and will be allowed to
  878. access dot files.
  879. ------------------------ RATIOS ------------------------
  880. If you want to force people to upload new files before being able to
  881. download other files, ratios are for you. It's a very good way to get lotsa
  882. fresh stuff on a public FTP server and a must for warez traders. I don't
  883. like that kind of business, but well... Pure-FTPd has to be designed to
  884. please everybody.
  885. To enable ratios, just use the '-q' option, followed by the upload:download
  886. ratio:
  887. -q 2:5
  888. ...means that an anonymous user has to upload at least 2 Mb of goodies to be
  889. able to download 5 Mb.
  890. If ratios should apply to everyone (anon and non-anon), use the '-Q' option
  891. the same way.
  892. Note: 'root' never has ratios. Neither have users of the trusted group when
  893. '-Q' in used with the '-a' or '-A' option.
  894. ------------------------ BANDWIDTH THROTTLING ------------------------
  895. Pure-FTPd has an interesting built-in feature: simple bandwidth throttling.
  896. * You want to limit FTP throughput so that uploading and downloading files
  897. through that protocol can't fill up your network bandwidth.
  898. -> Compile Pure-FTPd with --with-throttling
  899. -> Run it with the '-T' flag, followed by a number. That number is the
  900. maximum bandwidth a user can use in a session, in kilobytes/seconds.
  901. * You want to allow less bandwidth to your anonymous users than your
  902. authenticated ones. So that during a bandwidth starvation, real users can
  903. still upload/download properly.
  904. -> Compile Pure-FTPd with --with-throttling
  905. -> Run it with the '-t' flag, followed by a number.
  906. Example:
  907. /usr/local/sbin/pure-ftpd -t 64
  908. And uploading/downloading files can't take more than 64 KB/sec whatever real
  909. bandwidth you have.
  910. * It is possible to have different bandwidth limits for uploads and for
  911. downloads. '-t' and '-T' can indeed be followed by two numbers delimited by
  912. a column (':') . The first number is the upload bandwidth and the next one
  913. applies only to downloads. One of them can be left blank which means infinity.
  914. Example 1: 256 KB/s for uploads, 64 KB/s for downloads
  915. /usr/local/sbin/pure-ftpd -t 256:64
  916. Example 2: 256 KB/s for uploads, no limit for downloads
  917. /usr/local/sbin/pure-ftpd -t 256:
  918. Example 3: no limit for uploads, 64 KB/s for downloads
  919. /usr/local/sbin/pure-ftpd -t:64
  920. With no column, the value applies to both, so '-t 64' is an alias for
  921. '-t 64:64' .
  922. * When Pure-FTPd serves a session with restricted bandwidth, it decreases
  923. its process priority to 10. So, '-t 0' makes sense: during a CPU
  924. starvation, authenticated sessions may be more responsible than anonymous
  925. ones. '-T 0' is quite useless, but it also works and it will always be nice to
  926. the server process.
  927. * If you need advanced bandwidth management, have a look at your kernel
  928. Q.O.S. abilities.
  929. ------------------------ VIRTUAL SERVERS ------------------------
  930. Using Virtual servers is a convenient way of hosting several FTP sites on the same
  931. computer. Let's say, you got two customers. The former owns the 'cgx.org'
  932. domain name, while the latter owns the 'example.com' domain name. Both are
  933. hosted on the same computer, but they don't want to share the same files.
  934. ftp://ftp.cgx.org/ should show different content than ftp://ftp.example.com/
  935. .
  936. The FTP protocol doesn't allow name-based selection. So, if you want to host
  937. <N> different virtual FTP servers on the same host and keep the standard port,
  938. you need <N> different IP addresses. Yes, Sir. Or use HTTP.
  939. Assign the needed IP addresses to your network adapter (with "ifconfig eth0:x
  940. ..." or "ip addr add dev eth0 a.b.c.d").
  941. Now, create a /etc/pure-ftpd directory if it doesn't exist:
  942. mkdir /etc/pure-ftpd
  943. To add a virtual FTP server, you only need to create a symbolic link in
  944. /etc/pure-ftpd/ from the virtual host IP to the directory that contains the
  945. file for that virtual host.
  946. Example:
  947. ln -s /home/customers/example.com/ftp /etc/pure-ftpd/216.226.17.77
  948. ln -s /home/customers/cgx.org/ftp /etc/pure-ftpd/212.73.209.252
  949. Done! Put the CGX files in /home/customers/cgx.org/ftp/ and the Example
  950. files in /home/customers/example.com/ftp/ .
  951. With that feature, every account on the server can have its own public
  952. anonymous FTP area. If you are providing hosting services, this is a nice
  953. feature for your customers.
  954. * WARNING *: it also means that your customers can create "incoming"
  955. directories with 1777 permissions. It can be nice, but it can also fill up
  956. your disk with warez. You can stop uploads for anonymous users with the
  957. '-i' (or --anonymouscantupload) option.
  958. By default, all IP addresses assigned to your server can be accessed by real
  959. or anonymous users. You can restrict this with -e (only anonymous) or -E
  960. (only real) .
  961. A more flexible way is to use '-V <ip address>' to define a "trusted" IP
  962. address. When a client connects to that trusted IP, anonymous and real
  963. logins are permitted. But on all other IP, only anonymous users are permitted.
  964. If you are a hosting service provider and if each customer has its own IP
  965. address, it may be a nice idea to have a trusted IP you give to all your
  966. customers, so that they can manage the files in their account. That IP is
  967. the same for all customers. You can easily restrict access to that IP with
  968. firewall rules if your customers have static IP addresses.
  969. Use '-V <trusted ip>' and link /etc/pure-ftpd/<customer ip> to
  970. ~customer/ftp . Every customer will have his own *anonymous only* FTP
  971. server and hackers will have to find the trusted IP to get in.
  972. ------------------------ IPv6 SUPPORT ------------------------
  973. Pure-FTPd has full IPv6 support (native IPv6 addresses and 4-in-6
  974. addresses). But use a super-server that also understands the IPv6 protocol,
  975. like Rlinetd or Xinetd. Recent versions of Inetd should also be ok
  976. (unverified). IPv6 is supported everywhere: logging, configuration
  977. switches, virtual hosts, protocol (EPSV/EPRT support), name resolution...
  978. --------------------- LOGGING ---------------------
  979. Log messages are sent to the syslog daemon. You can disable logging with
  980. '-f none'.
  981. If you want all FTP messages to be redirected to a file, say /var/log/ftp,
  982. add this line to your /etc/syslog.conf file:
  983. ftp.* /var/log/ftp
  984. Then restart your syslogd daemon:
  985. pkill -x -s HUP syslogd
  986. You can also drop your old "syslogd" and "klogd" programs for Metalog, an
  987. efficient alternative: http://metalog.sourceforge.net/
  988. Names of uploaded/downloaded files are logged with paths like this:
  989. /home/ftp//pub/bla.jpg
  990. The double-slash ('//') is the chroot limit.
  991. --------------------- WATCHING CURRENT SESSIONS ---------------------
  992. Since 0.97.7, you can type 'pure-ftpwho' at any time to watch current active
  993. sessions.
  994. If typing 'pure-ftpwho' answers 'Command not found', you have to add
  995. /usr/local/sbin in your PATH environment variable.
  996. The default output looks like this:
  997. +------+---------+-------+------+-------------------------------------------+
  998. | PID | Login |For/Spd| What | File/IP |
  999. +------+---------+-------+------+-------------------------------------------+
  1000. | 2239 | jedi | 00:17 | D/L | XFree86-clients-4.0.3.tar.gz |
  1001. | '' | '' | 41K/s| 33% | -> nestea.funboard.de |
  1002. +------+---------+-------+------+-------------------------------------------+
  1003. | 2385 | ftp | 00:02 | IDLE | |
  1004. | '' | '' | | | -> gw2.crn.kjop.co.uk |
  1005. +------+---------+-------+------+-------------------------------------------+
  1006. 'D/L' means that the client is downloading and 'U/L' means he's uploading
  1007. some file whose name is shown in the next column. '33%' is the real-time
  1008. completion of the current operation. '41K/s' is the bandwidth used by the
  1009. client. You can track down who's starving your bandwidth with this.
  1010. The 'pureftp-who' command accepts interesting options:
  1011. '-c': the program is called via a web server (CGI interface) . Output is a
  1012. full HTML page with the initial content-type header. This option is
  1013. automatically enabled if an environment variable called GATEWAY_INTERFACE is
  1014. found. This is the default if you can access the program from a CGI-enabled web
  1015. server (Apache, Roxen, Caudium, WN, ...) .
  1016. '-h': show command-line options summary.
  1017. '-n': don't resolve host names and only show IP addresses (faster).
  1018. '-s': output an easily parsable format for shell scripts (but not very user
  1019. friendly) .
  1020. There's only one line per client, with only numeric data, delimited by a '|'
  1021. character. It's not very human-readable, but it's designed for easy parsing by
  1022. shell scripts (cut/sed) . '|' characters in user names or file names are
  1023. quoted ('|' becomes '\|') .
  1024. Type 'pure-ftpwho -h' to check the format.
  1025. '-w': output a complete HTML page (web mode).
  1026. '-W': output an HTML page with no header and no footer. This is an embedded
  1027. mode, suitable for inline calls from CGI, SSI or PHP scripts.
  1028. '-x': output well-formed XML data for post-processing. This is the most
  1029. acurate mode. Time is in seconds and file sizes are in bytes (in other
  1030. output formats, sizes are in kbytes for easier readability) .
  1031. '-v': verbose output in text mode. Additional info includes the size of
  1032. files being downloaded/uploaded, the local IP or local host name and the
  1033. connection port. This is especially useful for virtual hosts. Here's a
  1034. sample output of 'pure-ftpwho -v':
  1035. +------+---------+-------+------+-------------------------------------------+
  1036. | PID | Login |For/Spd| What | File/Remote IP/Size(Kb)/Local IP |
  1037. +------+---------+-------+------+-------------------------------------------+
  1038. | 9086 | j | 00:04 | DL | linux-2.4.4.tar.bz2 |
  1039. | '' | '' | 22K/s| 27% | -> localhost |
  1040. | '' | '' | | | Total size: 20859 Transferred: 5632 |
  1041. | '' | '' | | | <- localhost:21 |
  1042. +------+---------+-------+------+-------------------------------------------+
  1043. ------------------------ AFTER AN UPLOAD ------------------------
  1044. After an upload, any external program or shell script can be spawned with the
  1045. name of the newly uploaded file as an argument. You can use that feature to
  1046. automatically send a mail when a new file arrives. Or you can pass it to a
  1047. moderation system, an anti-virus, a MD5 signature generator or whatever you
  1048. decide can be done with a file.
  1049. To support this, the server has to be configured --with-uploadscript at
  1050. compilation time. Upload scripts won't be spawned on unreadable directories.
  1051. So it's highly recommended to use upload scripts with the --customerproof
  1052. run-time option and without unreadable parent directories.
  1053. To tell the FTP server to use upload scripts, it has to be launched with the
  1054. '-o' option. Finally, you have to run another daemon called 'pure-uploadscript'
  1055. provided by this package.
  1056. IMPORTANT:
  1057. YOU MUST START PURE-FTPD _FIRST_ and _THEN_ START PURE-UPLOADSCRIPT.
  1058. THE REVERSE ORDER WON'T WORK.
  1059. For security purposes, the server never launches any external program. It's
  1060. why there is a separate daemon, that reads new uploads pushed into a named
  1061. pipe by the server. Uploads are processed synchronously and sequencially.
  1062. It's why on loaded or untrusted servers, it might be a bad idea to use
  1063. pure-uploadscript with lengthy or cpu-intensive scripts.
  1064. The easiest way to run pure-uploadscript is 'pure-uploadscript -r <script>':
  1065. /usr/local/sbin/pure-uploadscript -r /bin/antivirus.sh
  1066. The absolute path of the newly uploaded file is passed as a first argument.
  1067. Some environment variables are also filled with interesting values:
  1068. - UPLOAD_SIZE : the size of the file, in bytes.
  1069. - UPLOAD_PERMS : the permissions, as an octal value.
  1070. - UPLOAD_UID : the uid of the owner.
  1071. - UPLOAD_GID : the group the file belongs to.
  1072. - UPLOAD_USER : the name of the owner.
  1073. - UPLOAD_GROUP : the group name the file belongs to.
  1074. - UPLOAD_VUSER : the full user name, or the virtual user name. (127 chars max)
  1075. There are also some options to "pure-uploadscript":
  1076. - '-u <uid>' and '-g <gid>' to switch the account pure-uploadscript will run
  1077. as. The script will be spawned with the same identity.
  1078. - '-B' to fork in background.
  1079. Please have a look at the man page ('man pure-uploadscript') for additional
  1080. info.
  1081. ------------------------ LISTING DIRECTORIES ------------------------
  1082. The built-in 'ls' supports all common options of a regular 'ls' command.
  1083. Here are the ones you should know for a better life with FTP:
  1084. - '-l': verbose listing, reporting dates, owners, perms and sizes.
  1085. - '-a': also lists files and directories beginning with a dot.
  1086. - '-F': adds a '/' after directory names.
  1087. - '-d': list the directory itself, not its content.
  1088. - '-R': recursive listing.
  1089. - '-S': sort by size.
  1090. - '-t': sort by date.
  1091. - '-r': reverse the sorting order.
  1092. If you aren't very familiar with Unix, log in to your FTP server and try
  1093. these variants:
  1094. ls
  1095. ls -F
  1096. ls -l
  1097. ls -la
  1098. ls -lR
  1099. ls -Sl
  1100. ls -Slr
  1101. ls -tl
  1102. ls -tlr
  1103. Globbing is also supported. So if you are looking for a GNOME RPM in
  1104. <I don't know the directory name>/gnome-xxxxxxxx.rpm , you can find it that
  1105. way:
  1106. ls */gnome*.rpm
  1107. ------------------------ VIRTUAL QUOTAS ------------------------
  1108. With virtual quotas, you can restrict the maximum number of files and the
  1109. total size of a user directory.
  1110. These quotas are "virtual" because they aren't handled at kernel-level, but
  1111. by the FTP server itself. There are some advantages over kernel quotas:
  1112. - Virtual quotas are specific to the FTP server. You can have different
  1113. system quotas to handle other files (eg. mail) on the same partition.
  1114. - You can have different virtual quotas for every user, even if they share
  1115. the same system uid.
  1116. - Virtual quotas are working even on filesystems that don't support system
  1117. quotas.
  1118. However, virtual quotas are slower and can't be as reliable as kernel quotas,
  1119. so don't trust them ultimately, they are probably races allowing to bypass
  1120. them. Also the filesystem users directories are on must properly support file
  1121. locking.
  1122. Virtual quotas are implemented in Pure-FTPd as simple files called
  1123. ".ftpquota", located in the home directory of chrooted users. This file only
  1124. contains two numbers: the current number of files for this user and the
  1125. total size of the directory (+ its subdirectories), in bytes. When a new
  1126. file is uploaded, these numbers grow. When a file is deleted, these numbers
  1127. get smaller. Simple. Of course, when virtual quotas are enabled for one
  1128. user, that user must be 1) chrooted, 2) not allowed to write quota files, 3)
  1129. not allowed to forbid access to some directories to fool the counter.
  1130. Quotas can be enabled for all users for the -n (--quotas) option. This
  1131. option is followed by the max number of files and the max size (in Megabytes)
  1132. . Every user will have the same quota. Exception: members of the trusted
  1133. group, if -a is enabled.
  1134. You can also have different quotas for every user if you use PureDB or SQL
  1135. databases. See the "README.Virtual-Users" file for more info about PureDB
  1136. databases.
  1137. So, if you want 1000 files max and 10 Mb max for all your customers, run
  1138. the server like this:
  1139. /usr/local/sbin/pure-ftpd -n 1000:10
  1140. ".ftpquota" files are created on demand when they are missing. However, when
  1141. they are created, the server assumes that the account was empty. If this is
  1142. not the case, you must run the "pure-quotacheck" utility to create an
  1143. initial ".ftpquota" file.
  1144. "pure-quotacheck" is a tool that computes the size and the number of files
  1145. in a directory and create a ".ftpquota" file with this info.
  1146. The syntax is:
  1147. pure-quotacheck -u username/uid -d home directory [-g group/gid]
  1148. For instance, if you want to summarize usage for the /home/ftpusers/john
  1149. directory, whose files are owned by the "ftpusers" system account, just run:
  1150. pure-quotacheck -u ftpusers -d /home/ftpusers/john
  1151. You can run pure-quotacheck whenever you want, even when ".ftpquota" files
  1152. are already there. This is even a good idea to run this for all users in
  1153. crontab, so that stored quotas are always exact, even if something went wrong
  1154. (server bug, filesystem corruption, savagely killed server, etc) .
  1155. ------------------------ AUTHENTICATION ------------------------
  1156. Pure-FTPd supports multiple methods of authentication. To use a method, you
  1157. must have it compiled in (check the ./configure options) .
  1158. - To use Unix authentication (the traditional /etc/passwd file), add the
  1159. following option when you run the server:
  1160. -l unix
  1161. - To use PAM authentication, add this:
  1162. -l pam
  1163. - To use PureDB (virtual users), add this:
  1164. -l puredb:/path/to/puredb_database
  1165. (read README.Virtual-Users for more info about PureDB indexed files)
  1166. - To use LDAP directories, add this:
  1167. -l ldap:/path/to/ldap_config_file
  1168. (read README.LDAP for more info about LDAP directories)
  1169. - To use MySQL databases, add this:
  1170. -l mysql:/path/to/mysql_config_file
  1171. (read README.MySQL for more info about MySQL databases)
  1172. - To use Postgres databases, add this:
  1173. -l pgsql:/path/to/postgres_config_file
  1174. (read README.PGSQL for more info about Postgres databases)
  1175. - To use external authentication handlers (with pure-authd), use:
  1176. -l extauth:/path/to/authd/socket
  1177. (read README.Authentication-Modules for more info about external
  1178. authentication)
  1179. Multiple authentication methods can be chained. For instance, you can run the
  1180. server like this:
  1181. /usr/local/sbin/pure-ftpd -lldap:/etc/pureftpd-ldap.conf \
  1182. -lpuredb:/etc/pureftpd.pdb -lunix
  1183. Every method is tried in order. With the previous command line, an LDAP
  1184. directory is probed first. If a user isn't found in the directory, a
  1185. PureDB database is scanned for the same user name. If that user is still not
  1186. found, /etc/passwd is scanned.
  1187. If the user is found in the LDAP directory, but the given password is wrong,
  1188. further authentication methods are skipped.
  1189. If you don't specify any -l option, PAM is assumed by default if the server
  1190. is compiled with PAM support and Unix is assumed by default otherwise.
  1191. ------------------------ DIRECTORY ALIASES ------------------------
  1192. Directory aliases provides "shortcuts" for the "cd" command. For instance,
  1193. if you define an alias called "pictures" for "/usr/misc/pictures", when an
  1194. user will type "cd pictures" and if no real "pictures" directory exists, he
  1195. will be automatically redirected to "/usr/misc/pictures". Unlike symbolic
  1196. links, "cd pictures" will work from any directory. Tildes are *not* expanded.
  1197. a user can get the list of available aliases with the following command:
  1198. SITE ALIAS
  1199. To support that feature, the server must be compiled with --with-diraliases
  1200. passed to ./configure .
  1201. To define alias/directory pairs, you must create a file called
  1202. /etc/pureftpd-dir-aliases, whose format is:
  1203. Alternating lines of alias and dir
  1204. (this enables embedded whitespace in dir and alias without quoting rules)
  1205. Optional blank lines
  1206. Optional lines beginning with '#' as comments
  1207. (no you can't put a '#' just anywhere)
  1208. Example:
  1209. pictures
  1210. /usr/misc/pictures
  1211. sources
  1212. /usr/src
  1213. # This is for the OpenBSD port tree
  1214. pureftpd-port
  1215. /usr/ports/net/pure-ftpd
  1216. ------------------------ PRIVILEGE SEPARATION ------------------------
  1217. When privilege separation is enabled, each session will spawn two processes :
  1218. a "privileged" process running as root, but that can only do very basic
  1219. and trusted actions (binding a port and remove the ftpwho scoreboard) and
  1220. the "client" process. The "client" process definitely revokes all privileges
  1221. after authentication and chroot() and punctually communicates with the
  1222. parent over a private channel.
  1223. Privilege separation decreases performance of loaded servers, but it
  1224. increases security and reliability. Enabling it is recommended.
  1225. Some old broken operating systems may allow the ptrace() system call on
  1226. processes that revoked privileges. On these platforms, enabling privilege
  1227. separation is a bad idea if untrusted users also have shell access. Use the
  1228. src/ptracetest program to check this. At least Solaris, ISOS, MirBSD,
  1229. OpenBSD, DragonflyBSD, FreeBSD and Linux are known to be safe.
  1230. ------------------------ CHARSETS (RFC2640) ------------------------
  1231. Since version 1.0.21, pure-ftpd has *experimental* support for charsets
  1232. conversion. The server filesystem can use a different charset than the
  1233. charset assumed by clients, and pure-ftpd translates file names through the
  1234. iconv library.
  1235. Some modern clients like lftp will also try to use UTF-8 if the server
  1236. supports it.
  1237. Thus, charsets conversion can be very useful when dealing with file names
  1238. containing non-english characters.
  1239. In order to support this, pure-ftpd has to be compiled with:
  1240. ./configure ... --with-rfc2640
  1241. This is not supported by default because it requires libiconv.
  1242. Then the server has to be started with --fscharset=<charset>. Replace
  1243. <charset> with the charset of the server's filesystem. For instance:
  1244. /usr/local/sbin/pure-ftpd --fscharset=ISO-8859-15
  1245. This is often enough to properly work with UTF-8 capable clients.
  1246. But optionnally, you can specify the default charset for clients, with
  1247. --clientcharset:
  1248. /usr/local/sbin/pure-ftpd --fscharset=iso-8859-15 --clientcharset=big5
  1249. ------------------------ OPTIMIZING FOR HIGH LOAD ------------------------
  1250. If you are going to use Pure-FTPd on a highly loaded server, here are some
  1251. hints to get the best performances:
  1252. - Compile with:
  1253. env CFLAGS="-O2 -fomit-frame-pointer -fgcse -Os" ./configure --with-minimal --without-inetd --without-pam
  1254. make install-strip
  1255. - Run it in standalone mode. Don't use -C, don't enable pure-ftpwho nor
  1256. pure-uploadscript (-o), nor per-user limits (-y) .
  1257. - Increase your system max descriptors number and local port range. On a
  1258. Linux kernel, you can try:
  1259. echo 2000 > /proc/sys/fs/super-max
  1260. echo 60000 > /proc/sys/fs/file-max
  1261. ulimit -n 60000
  1262. echo 30000 65534 > /proc/sys/net/ipv4/ip_local_port_range
  1263. - On a Linux kernel, disable syncookies, ecn, timestamps and window scaling:
  1264. echo 0 > /proc/sys/net/ipv4/tcp_syncookies
  1265. echo 0 > /proc/sys/net/ipv4/tcp_ecn
  1266. echo 0 > /proc/sys/net/ipv4/tcp_timestamps
  1267. echo 0 > /proc/sys/net/ipv4/tcp_window_scaling
  1268. - Disable access time update on your mounted filesystems. On a Linux system,
  1269. just add 'noatime,nodiratime' for each mount point in your /etc/fstab file.
  1270. - Disable syslog output and DNS lookups. Run it with:
  1271. /usr/local/sbin/pure-ftpd -f none -H
  1272. For FreeBSD, DJ_Oggy recommends the following setting:
  1273. >>> QUOTE:
  1274. Drop into single user mode (do a shutdown now or boot -s) and enter
  1275. tunefs -n enable <filesystem>
  1276. i sugest / /usr /var
  1277. In /etc/fstab add ",noatime" to the options of all filesystems.
  1278. In /boot/loader.conf add the following:
  1279. hw.ata.wc="1"
  1280. kern.ipc.nmbclusters="60000"
  1281. In /etc/sysctl.conf add the following:
  1282. vfs.vmiodirenable=1
  1283. kern.ipc.maxsockbuf=2097152
  1284. kern.ipc.somaxconn=8192
  1285. kern.ipc.maxsockets=16424
  1286. kern.maxfiles=65536
  1287. kern.maxfilesperproc=32768
  1288. net.inet.tcp.rfc1323=1
  1289. net.inet.tcp.delayed_ack=0
  1290. net.inet.tcp.sendspace=65535
  1291. net.inet.tcp.recvspace=65535
  1292. net.inet.udp.recvspace=65535
  1293. net.inet.udp.maxdgram=57344
  1294. net.local.stream.recvspace=65535
  1295. net.local.stream.sendspace=65535
  1296. give it two asprin, a reboot and call me in the morning!!!!!
  1297. <<< END OF QUOTE
  1298. ------------------------ KNOWN ISSUES ------------------------
  1299. - On non-linux systems, '-c' only works in standalone mode.
  1300. - You should always avoid the use of spaces in login names: applications
  1301. that are parsing log files often choke on this.
  1302. - Incomplete transfers aren't logged in alternative formats.
  1303. - On Solaris, to get chroot to work with pure-ftpd you need a dev directory
  1304. in your new rootdir with these:
  1305. crw-rw-rw- 1 root other 11, 42 Dec 10 15:02 tcp
  1306. crw-rw-rw- 1 root other 105, 1 Dec 10 15:02 ticotsord
  1307. crw-rw-rw- 1 root other 11, 41 Dec 10 15:03 udp
  1308. crw-rw-rw- 1 root other 13, 12 Dec 10 15:03 zero
  1309. else you get this
  1310. ftp> ls
  1311. 425 Can't create the data socket: Bad file number.
  1312. If all your users are chrooted, you have to create these files in every home
  1313. directory. Here's how:
  1314. mkdir dev
  1315. mknod dev/tcp c 11 42
  1316. chmod 0666 dev/tcp
  1317. mknod dev/udp c 11 41
  1318. mknod dev/zero c 13 12
  1319. mknod dev/ticotsord c 105 1
  1320. (Reported by Kenneth Stailey)
  1321. - Resuming ASCII transfers is refused. ASCII transfers are hell, because
  1322. they are consuming CPU time both at client and server sides. And they even
  1323. consume *more* bandwidth than binary transfers. But they allow Windows
  1324. clients to upload scripts to Unix servers, stripping these nasty ^M signs.
  1325. ASCII transfers are implemented in Pure-FTPd. But they can't be resumed and
  1326. this is intentional. To restart an ASCII transfer, the file has to be
  1327. read and analyzed byte by byte. It can be very long and by sending two
  1328. trivial commands, a client can completely kill a server (take a lot of CPU and
  1329. disk resources) . And there's no workaround.
  1330. Another point is that while RFC describe a way to resume ASCII transfers,
  1331. many clients and servers implement them in another way. The result is that
  1332. resumed ASCII transfers can lead to data corruption. Some major servers
  1333. didn't follow RFC, so some clients did the same mistake to support these
  1334. servers, while some other modern clients and servers are trying to fully
  1335. conform to RFC. So when clients and servers are speaking the same dialect, it
  1336. works. When it's not the case, you get corrupted files. Messy, eh?
  1337. And what if a customer uploads a script to your server and thinks he can
  1338. safely delete it from its hard disk? If the remote file is corrupted, he
  1339. will get really angry.
  1340. It's why Pure-FTPd *refuses* to resume ASCII transfers. If a customer tells
  1341. you that he isn't able to upload/download a partially transferred ASCII file,
  1342. please tell them to remove the partial file and to retransfer it again. This
  1343. is a safe bet.
  1344. ------------------------ DOWNLOADING PURE-FTPD ------------------------
  1345. Pure-FTPd home page is: https://www.pureftpd.org/ .
  1346. Git repository: https://github.com/jedisct1/pure-ftpd
  1347. Thank you,
  1348. -Frank DENIS "Jedi/Sector One" <j at pureftpd dot org>