]> git.sesse.net Git - betaftpd/blob - README
Fixed a security problem where the custom snprintf() would always be used. Thanks...
[betaftpd] / README
1 Hmmmmm... :-)
2
3 [Insert insanely cool ASCII logo here yourself -- I'd rather spend my time
4  coding]
5
6 0. Before you start
7 -------------------
8 This is NOT a stable version of BetaFTPD. The latest stable, tried and tested
9 version is 0.0.7. Use this version at your own risk. That being said, this
10 version is rather stable now, actually _more_ stable than 0.0.7, which contains
11 quite a few lethal bugs, and is almost a year old.
12
13 1. What is it?
14 --------------
15 BetaFTPD is a _single_-threaded FTP daemon (server). This makes it _faster_
16 than most other FTP daemons (in most situations), contrary to popular belief.
17 BetaFTPD is, as the name implies, work in progress. Please don't expect it to
18 be finished yet!
19
20 2. How do you build it?
21 -----------------------
22 BetaFTPD uses GNU autoconf. Just type:
23
24 ./configure
25 make
26
27 And see what happens. (Run the resulting file called `betaftpd', of course...)
28 There are some flags that you can (and probably want to) give to `configure':
29
30 --enable-xferlog        Makes the server output some logging information
31                         to /var/log/xferlog (or /usr/adm/xferlog if that fails).
32 --enable-fullscreen     Makes the server start in fullscreen mode, where you
33                         can see what the users are doing, their transfer
34                         speed etc. (There is other no way of turning on or off
35                         fullscreen mode -- this switch is the only way.)
36 --enable-upload         Enable STOR (uploading) and APPE commands, and all necessary
37                         code for uploading.
38 --enable-stat           Enable STAT command (server statistics). Note that I see
39                         very little use for such a command, and you shouldn't enable
40                         it unless you have a very good reason. Such commands are
41                         one of the best weapons in a cracker's arsenal. It is only
42                         included for RFC1123 compliance, and disabled by default.
43                         In addition, it tries to give as little `cracker-help' data
44                         as possible. 
45 --enable-shadow         Enable support for shadow passwords.
46 --enable-fork           Makes the server fork into the background, so you
47                         can logout etc. without `disturbing' it.
48 --enable-nonroot        Enable running without root privilegies. Please read    
49                         README.nonroot _first_, it will save you a lot of
50                         grief.
51 --enable-ascii          Enable ASCII mode transfers (ASCII translation on-the-fly).
52 --enable-dcache         Enable directory listing caches, for faster directory
53                         listings (the listings are only generated the first time
54                         they are needed). Note that this still quite experimental
55                         code, and the cache is only invalidated when it expires
56                         (ie. if nobody uses the entry in 15 minutes), or when
57                         files are added or deleted in the cached directory.
58                         (In other words, if a file is changed, the directory
59                         cache entry is _not_ updated. Do a `touch' on the directory
60                         to force invalidation of the dcache entry.)
61 --enable-message        Enable welcome.msg/.message files and README notes, like
62                         `normal' ftpds do. Note that this is relatively crude
63                         (and probably will stay so) -- for instance, README notes
64                         and .message files are printed every time the user enters
65                         the directory, even if he/she has been there before.
66
67 To get the smallest executable possible, _first_ check everything in
68 `strip-exec' (it's unsupported -- don't complain to me if it doesn't work, fix
69 it yourself! :-) ), and type:
70
71 strip-exec
72
73 3. Some things to note
74 ----------------------
75 a) BetaFTPD now listen on port 21 by default (it used to run on port 121). To
76    change it, change FTP_PORT in ftpd.h to whatever you'd like it to listen on.
77 b) BetaFTPD must definitely be run as root (unless you use --enable-nonroot as
78    mentioned above). 
79 c) Some commands and features are missing, but probably not many that you'd
80    really miss. See the KNOWN-BUGS and RFC-COMPLIANCE files.
81 d) BetaFTPD can _not_ be run from inetd. This is a design decision.
82
83 4. Design decisions
84 -------------------
85 BetaFTPD was originally designed to be a single-threaded FTP server, nothing
86 else. After a while, work was done to reduce the executable size, and from
87 then, design was more and more concentrated around a `minimalistic' server
88 (after all, the fewer lines of code there are to execute, the faster will
89 things go, and the fewer bugs are possible).
90
91 However, as GNU autoconf support was added, it was realized that features could
92 be added and selected by users without hurting overall speed or size for the
93 others. Therefore, more and more features are (and will be) implemented in
94 BetaFTPD.
95
96 There are intendedly no command line switches it BetaFTPD. Such switches are
97 generally there to make for quick change of options without recompiling the
98 program. This is ideal for most command-line utilities, but is rather pointless
99 for an FTP server. FTP servers are designed to be online 24 hours a day, 7 days
100 a week, and serve users with files.  Rapid confiuration changes (in the form of
101 command line switches, configuration files et al) are usually not important,
102 and has thus been omitted from BetaFTPD.
103
104 There is no (and will never be a) ratio function in BetaFTPD, as such features
105 are only used for warez/MP3/porn servers, and are quite stupid even then.
106
107 5. Eek! `top' says BetaFTPD uses tons of memory!
108 ------------------------------------------------
109 Yes, but top really is wrong :-) Well, actually, I don't think it could do
110 better -- every file BetaFTPD mmap()s is counted towards the total number. So
111 if you were serving the same 128MB file 10 times, top would claim you used over
112 a gigabyte of memory, still only a couple of megabytes would be used at most,
113 as cache. If you ran out of memory, this could actually shrink to zero. It's
114 just that the kernel tries to be more effective (and it succeeds) by reducing
115 the number of reads, and instead reading larger chunks at once. Actually, for
116 32-bit architectures, if you serve large several large files, you might get a
117 problem with hitting the 2GB address space (every mmap() counts towards this
118 limit, it appears). The solutions are many: Use sendfile() (see below), do
119 without mmap, or enable high memory support in your kernel (at least Linux
120 2.3/2.4 can do this at compile time). For most of us, though, this will never be
121 a problem, just be aware of it if you're doing a benchmark, for instance. Future
122 versions of BetaFTPD might just mmap() once per file (instead of once per
123 transfer per file), but this is probably more problems than it's worth.
124
125 If sendfile() support is enabled (note that only Linux sendfile() is working at
126 the moment, BSD sendfile() is detected but not utilized), and the circumstances
127 allow it (binary mode downloading), BetaFTPD will not mmap() at all, bringing
128 the memory total down to a more realistic value.
129
130 Bragging:
131
132 On my Intel system, every user needs 1104 bytes (`struct conn').  When a user
133 has a file transfer, an additional 324 bytes (`struct ftran') would be needed,
134 or 1428 bytes per user in total. In addition, you have some `startup costs', of
135 course. `ps' (again on my system) reports a startup memory usage of 432 kB
136 (RSS, I don't know enough about memory to know if this is a realistic number
137 ;-) ), compared to 484 kB for a single wu-ftpd session (again RSS). To be
138 honest, I don't think BetaFTPD uses much memory. [Note that this information is
139 a bit old -- I haven't tested it lately; expect 2-300 bytes extra per user.]
140
141 Oh, while we're at it: A 486 running BetaFTPD will easily be able to saturate a
142 T1 line, with room to spare. The bottleneck will most likely lie somewhere else
143 (like the bandwidth, or how fast the disk can deliver data). Unless you've got
144 a 386 running gigabit, of course... (I must admit, I've never really tried it
145 with more than 100Mbit/sec, but the problem then was clearly on the client
146 machine ;-) BetaFTPD has later shown itself to be more than able of saturating
147 a 10mbit link in real- world tests, with about 3% CPU utilization (PII/450MHz,
148 IDE disks all the way, about 2GB of files in all, 7-8 users at once).)
149
150 Recent load tests (see http://www.kegel.com/dkftpbench/results.html) show that
151 a P90 is able to serve about 250 clients (each at 28.800-speeds) on a 10Mbit
152 line.
153
154 6. Misc.
155 --------
156 Have fun -- after all, it's about 5% the size of wu-ftpd (about 20k compiled!)
157 and provides (IMHO) about 98% of the needed, everyday functionality -- in fact,
158 if you don't need the _really_ exotic commands, it's faster (=better?) and uses
159 *much* less memory (especially when you have many users logged in at once) than
160 the majority of the FTP servers out there... (5 line sentence.)
161
162 This program is GPLed, version 2 (see the file COPYING), not any later or
163 earlier version (later versions will probably `upgrade' to new GPLs as they
164 become available, I just want to be able to choose what license I put my code
165 under). For more info on the GPL, visit http://www.gnu.org/ .
166
167 7. Where to get new versions, contact me etc.
168 ---------------------------------------------
169 Homepage, new versions: http://betaftpd.sourceforge.net/
170 Mirror site:            ftp://metalab.unc.edu/pub/Linux/system/network/daemons/
171                         (Note that Metalab will always lag behind a few days, and
172                          doesn't carry beta versions.)
173
174 The homepage also contains information on how to get the very latest copy of
175 BetaFTPD via CVS, a bug tracker, a patch tracker, more mirror pages, nightly
176 CVS tarballs and much more, thanks to SourceForge. The old page at xoom.com
177 has been discontinued; please update your links accordingly.
178
179 -Steinar H. Gunderson <sgunderson@bigfoot.com>