FAQ 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  1. FREQUENTLY ASKED QUESTIONS
  2. --------------------------------------------------
  3. * Users can delete root-owned files?
  4. -> I have a directory owned by 'john', but I've put some files owned by
  5. 'root' (or another user) in it. However, I noticed that John can delete
  6. these files!
  7. Yes, this is the standard Unix behavior: the owner of a directory can do
  8. whatever he likes to do in his directory, regardless of who owns the file in
  9. it. If you want to have immutable files, check for such a feature in your
  10. operating system.
  11. For instance, on Linux filesystems, "chattr +i <file>" does the trick.
  12. On BSD systems, try "chflags schg <file>" .
  13. * Directories shared by multiple users.
  14. -> I have a "public" directory. All users can download and upload files
  15. from/to this directory. Permissions are 777 on it. But user 'john' can
  16. delete files owned by user 'joe'. How to prevent this?
  17. Put the sticky bit on that directory: chmod 1777 public. That way, the
  18. directory remains public (read/write), but people can only delete files they
  19. own.
  20. * Restricting directory visibility.
  21. -> I want that people only see their home directory and their own files. I
  22. don't want them to look at my systems files.
  23. This feature is called "chroot". You can enable this by running pure-ftpd
  24. with the "-A" switch to do this with ALL your users (but root) .
  25. You can alternatively use "-a <gid>" to have a "trusted group". Everyone
  26. will be caged, EXCEPT members of that group.
  27. Don't use -a <gid> and -A together.
  28. Another way is to selectively choose what users you want to chroot. This can
  29. be done with the /./ trick (see the README file about this) or with virtual
  30. users.
  31. * Shared directories and chroot.
  32. -> I have a directory, say /var/incoming, that I want to be shared by every
  33. user. But I want my users to be chrooted. So /var/incoming should be visible
  34. in 'joe' and 'john' accounts, but those are chrooted. So, how to have the
  35. content of /var/incoming visible in these accounts?
  36. Making a symbolic link won't work, because when you are chrooted, it means
  37. that everything outside a base directory (your user's home directory) won't
  38. be reachable, even though a symbolic link.
  39. But all modern operating systems can mount local directories to several
  40. locations. To have an exact duplicate of your /var/incoming directory
  41. available in /home/john/incoming and /home/joe/incoming, use one of these
  42. commands:
  43. * Linux : mount --bind /var/incoming /home/john/incoming
  44. mount --bind /var/incoming /home/joe/incoming
  45. * Solaris : mount -F lofs /var/incoming /home/john/incoming
  46. mount -F lofs /var/incoming /home/joe/incoming
  47. * FreeBSD : mount_null /var/incoming /home/john/incoming
  48. mount_null /var/incoming /home/joe/incoming
  49. Another alternative is to compile Pure-FTPd with --with-virtualchroot as a
  50. ./configure option. With virtual chroot, symbolic links pointing outside a
  51. chroot jail *are* followed.
  52. Binary packages are compiled with this feature turned on.
  53. * Tar and/or gzip on the fly
  54. -> Is it possible to use a command like "get directory.tar" as with Wu-FTPd
  55. ? (Sven Goldt)
  56. Unfortunately, no. Server-side gzip/tar creation is not a present nor a
  57. planned feature. It has been responsible of severe security flaws in Wu-ftpd
  58. and BSD ftpd, it can take a lot of server resource (denial-of-service) and
  59. it's a pain to set up (chrooted environment => need to add /etc /lib /bin
  60. directories, /dev on some platforms, etc) .
  61. * How to restrict access to dot files ?
  62. -> Is there an option to prevent people from accessing "." files/dirs (such
  63. as .bash_history, .profile, .ssh ...) EVEN if they are owned by the user ?
  64. (William Kern)
  65. Yes. '-x' (--prohibitdotfileswrite) denies write/delete/chmod/rename of
  66. dot-files, even if they are owned by the user. They can be listed, though,
  67. because security through obscurity is dumb and software shouldn't lie to
  68. you. But users can't change the content of these files.
  69. Alternatively, you can use '-X' (--prohibitdotfilesread) to also prevent
  70. users from READING these files and going into directories that begin with
  71. "." .
  72. * Log files
  73. -> Where does logging info go ? How to redirect it to a specific file ? How
  74. to suppress logging ?
  75. Log messages are sent to the syslog daemon. The syslog daemon is often
  76. called syslogd or syslog-ng. He's in charge of dispatching logging events
  77. from various programs to log files, according to a "facility" (category) and
  78. a "priority" (urgency: debug, info, warning, error, critical...) .
  79. Pure-FTPd logging messages are send with the "ftp" facility by default (or
  80. "local2" on some older systems without the "ftp" facility) . Unless you told
  81. the syslogd to redirect messages with the "ftp" facility to a specific file,
  82. the messages will be merged into /var/adm/messages, /var/log/messages,
  83. /var/adm/syslog or /var/log/syslog.
  84. Check /etc/syslogd.conf. You should have a line like:
  85. *.*;mail.none;news.none -/var/log/messages
  86. just add ftp.none:
  87. *.*;ftp.none;mail.none.news.none -/var/log/messages
  88. And if you want FTP info go in a specific file, just add:
  89. ftp.* /var/log/ftp
  90. and all FTP messages will go in /var/log/ftp . And only there.
  91. The facility can be changed if you add the -f <facility> option to pure-ftpd
  92. (or --facility=<facility>) .
  93. To completely disable logging, use -f none (or --facility=none) . If you
  94. don't read your log files, it's recommended: it will improve performance
  95. and reduce disk I/O.
  96. * How to prevent your partitions to be filled
  97. -> Is it possible to forbid new uploads when the disk is almost full ?
  98. (Cyberic)
  99. Use the "-k" (--maxdiskusagepct) flag. If you add -k 95 , no new upload can
  100. occur if your partition if more than 95% full.
  101. * Firewalling
  102. -> My FTP server is behind a firewall. What ports should I open?
  103. First, you have to open port 21 TO the FTP server. You also have to allow
  104. connections FROM (not to) ports <= 20 (of the FTP server) to everywhere.
  105. That's enough to handle the "active" mode. But that's not enough to handle all
  106. types of clients. Most clients will use another mode to transmit data called
  107. 'passive' mode. It's a bit more secure than 'active' mode, but you need to
  108. open more ports on your firewall to have it work.
  109. So, open some ports TO the FTP server. These ports should be > 1023. It's
  110. recommended to use at least twice the max number of clients you are
  111. expecting. So, if you accept 200 concurrent sessions, opening ports 50000 to
  112. 50400 is ok.
  113. Then, run pure-ftpd with the '-p' switch followed by the range configured in
  114. your firewall. Example: /usr/local/sbin/pure-ftpd -p 50000:50400 &
  115. Unlike some popular belief, the MORE opened ports you have for passive FTP,
  116. the MORE your FTP server will be secure, because the LESS you are vulnerable
  117. to data hijacking.
  118. If your firewall also does network translation (NAT), you have to enable
  119. port forwarding for all passive ports.
  120. On the client side, if a client if behind a firewall, that firewall must
  121. understand the FTP protocol. On Linux firewalls (iptables), just load
  122. the ip_conntrack_ftp and ip_nat_ftp modules. On OpenBSD, ISOS and
  123. FreeBSD 5 firewalls (PF), redirect all traffic to port 21, to ftp-proxy.
  124. * Unable to log in (unix authentication)
  125. -> I'm using simple Unix authentication. No PAM, no puredb, no MySQL, no
  126. LDAP. Anonymous FTP works, but I can't log in as any other user. It keeps
  127. saying "authentication failed".
  128. To log in, the shell assigned to your users must be listed in the
  129. /etc/shells file. The exact path should be there, even for fake shells like
  130. /etc or /bin/true.
  131. Also double check that you have a carriage return after the last line in
  132. /etc/shells.
  133. * Network filesystems.
  134. -> I have a strange problem on Linux or FreeBSD. Uploading a file works
  135. fine, but downloading a file only create 0-byte files. On the server, these
  136. files are on NFS/Novell shares/Appletalk shares/Coda/Intermezzo/SMB volumes.
  137. By default, pure-ftpd uses zero-copy networking in order to increase
  138. throughput and reduce the CPU load. But zero-copy doesn't work with all
  139. filesystems, especially network filesystems.
  140. You have to disable zero-copy if you want to serve files from a network FS
  141. or from a TMPFS virtual disk.
  142. To disable zero-copy, recompile pure-ftpd with ./configure --without-sendfile
  143. * Solaris and chroot.
  144. -> When I ftp to my Solaris server, I get this as an answer to 'ls':
  145. "425 Can't create the data socket: Bad file number."
  146. On Solaris, to get chroot to work with pure-ftpd you need a dev directory
  147. in your new rootdir with these:
  148. crw-rw-rw- 1 root other 11, 42 Dec 10 15:02 tcp
  149. crw-rw-rw- 1 root other 105, 1 Dec 10 15:02 ticotsord
  150. crw-rw-rw- 1 root other 11, 41 Dec 10 15:03 udp
  151. crw-rw-rw- 1 root other 13, 12 Dec 10 15:03 zero
  152. (Reported by Kenneth Stailey)
  153. * Upgrading.
  154. -> Can anyone explain how to update Pureftpd (from source), without having
  155. to change all my settings etc. (Simon H)
  156. 1) get the source code and unpack it.
  157. 2) ./configure it with your favorite options
  158. 3) make
  159. 4) rm -f /usr/local/sbin/pure-ftpd
  160. 5) make install-strip
  161. 6) if you run pure-ftpd from inetd,tcpserver,xinetd, etc: nothing left to do. You have it upgraded.
  162. 7) if you run it standalone, stop the server:
  163. kill $(cat /var/run/pure-ftpd.pid)
  164. then launch it again:
  165. /usr/local/sbin/pure-ftpd &
  166. * FTP over SSH.
  167. -> How to run Pure-FTPd over SSH? I want to encrypt all connection data
  168. (including passwords) .
  169. FTP-over-SSH is a nice alternative over FTP-over-TLS (impossible to securely
  170. firewall) and SFTP (which is slower, but only uses one port) .
  171. Customers using Windows can use FTP-over-SSH with the excellent Van Dyke's
  172. SecureFX client (http://www.vandyke.com) . It doesn't require any special
  173. knowledge: just tell your customer to check "FTP-over-SSH2" in the
  174. "Protocol" listbox when creating an account for your FTP server.
  175. On the server side, here's how to manage FTP-over-SSH accounts:
  176. 1) Add /usr/bin/false to your /etc/shells file (on some systems, it's
  177. /bin/false) .
  178. 2) To create a FTP-over-SSH account, create a system account with /dev/null
  179. as a home directory and /usr/bin/false as a shell. You don't need a
  180. dedicated uid: the same uid can be reused for every FTP-over-SSH account.
  181. 3) Create a virtual user account for that user (either with PureDB, SQL or
  182. LDAP) . Give that virtual user a real home directory and only allow
  183. connections coming from 127.0.0.1 (all FTP-over-SSH sessions will come from
  184. localhost, due to SSH tunneling) .
  185. People with no home directory (/dev/null) and no valid shell
  186. (/usr/bin/false) won't be able to get a shell nor to run any command on your
  187. server. But they will be granted FTP-over-SSH sessions.
  188. Here are examples (Linux/OpenBSD/ISOS commands, translate them if necessary) .
  189. 1) Creating a regular FTP account:
  190. pure-pw useradd customer1 -m -d /home/customer1 -u ftpuser
  191. 2) Creating a FTP-over-SSH account (non-encrypted sessions are denied):
  192. useradd -u ftpuser -g ftpgroup -d /dev/null -s /usr/bin/false customer2
  193. pure-pw useradd customer2 -m -d /home/customer2 -u ftpuser -r 127.0.0.1/32
  194. 3) Creating an account who can use regular (unencrypted) FTP from the
  195. internal network (192.168.1.x), but who must use FTP-over-SSH when coming
  196. from an external network (internet):
  197. useradd -u ftpuser -g ftpgroup -d /dev/null -s /usr/bin/false customer3
  198. pure-pw useradd customer3 -m -d /home/customer3 -u ftpuser \
  199. -r 127.0.0.1/32,192.168.1.0/24
  200. * Virtual users: /etc/pureftpd.pdb .
  201. -> I made changes to /etc/pureftpd.passwd but the server doesn't understand
  202. them: I can't access any account I just created.
  203. The server never reads /etc/pureftpd.passwd directly. Instead, it reads
  204. /etc/pureftpd.pdb (or whatever file name you gave after -lpuredb:...) .
  205. This file is a copy of /etc/pureftpd.passwd, but in a binary format,
  206. optimized for fast lookups.
  207. After having made a manual change to /etc/pureftpd.passwd, you must rebuild
  208. /etc/pureftpd.pdb with the following commands:
  209. pure-pw mkdb
  210. If you add/delete/modify user accounts with pure-pw useradd/usermod/userdel/
  211. passwd, don't forget the '-m' option to automatically rebuild
  212. /etc/pureftpd.pdb and not only update /etc/pureftpd.passwd .
  213. * Giving access to dot-files.
  214. -> I don't want my users to read files beginning with a dot. Except one file
  215. I'd like to give 'John' read (and maybe write) access to.
  216. Create a symbolic link in John's account, pointing to the dot-file. Example:
  217. ln -s .bashrc bashrc
  218. John will be able to access ".bashrc" through the symbolic link, "bashrc".
  219. * Initial banner.
  220. -> How do I display a customized message before the login prompt?
  221. Compile with --with-cookie and run the server with -F <file name> . In that
  222. file, put a nice customized banner message.
  223. * Internet Explorer.
  224. -> Internet Explorer doesn't show any login box.
  225. IE does a very strange trick to detect whether an FTP server does accept
  226. anonymous connections or not. Basically, it connects to the server and logs
  227. in as 'anonymous'. But if you say 'no' at this point, it drops the
  228. connections with an error. You have to say 'ok, anonymous users are
  229. allowed' and then, when a dummy password ('IE@') is sent, you say 'ah
  230. ehm... finally... no... anonymous users aren't allowed' . Silly. To play
  231. that game, you must run pure-ftpd with the -E (non-anonymous server) and -b
  232. (compatibility with broken clients) flags. Then, the magic popup will show
  233. up. But please note that IE (and browsers at large) are usually bad FTP
  234. clients.
  235. -> Internet Explorer doesn't want to log in. (Matthew Enger)
  236. Check that the max number of connections (either per user or per IP) is at
  237. least 2. IE needs two connections to connect to an FTP server.
  238. * Passwords and pure-pw scripting.
  239. -> I would like to create virtual users with a shell-script. if i us
  240. pure-pw useradd ..... it always asks for the new password. is there any
  241. command-line option which tells pure-pw the password (like useradd ftp-user
  242. ftp-password -m) ? (at1ce) .
  243. Giving cleartext (and badly one-way hashed) passwords through command-line
  244. switches is a bad idea. Because users could issue a simple 'ps' command and
  245. discover these passwords.
  246. One way to enter a password (not from the keyboard) is to put the password
  247. twice in a temporary file, then redirect that file to stdin. Example:
  248. pure-pw useradd john -d /tmp/john -u ftpuser -m < ~/tmp/passfile
  249. And in ~/tmp/passfile, have something like:
  250. john's password
  251. john's password
  252. If you really need to avoid a temporary file and if nobody but you can log
  253. on the machine, you can always do this:
  254. (echo blahblah; echo blahblah) | pure-pw useradd john -d /tmp/john -u ftpuser
  255. * Altlog and pure-uploadscript don't work.
  256. -> pure-uploadscript doesn't run anything. Alternative logging methods (CLF,
  257. stats, W3C...) create a logfile, but it always stays empty.
  258. Maybe your operating system has a buggy realpath() implementation. Some
  259. old Solaris and Linux versions are known to have such a bug.
  260. Try to recompile pure-ftpd, but run ./configure with the --with-brokenrealpath
  261. switch first.
  262. * The server starts, but doesn't listen to any port?
  263. -> The server is properly running, I see it in the process list, but any try
  264. to connect to the configured port (or port 21 by default) fails. The socket
  265. isn't even open.
  266. Check two things :
  267. - If you are running a BSD system and you want to listen to IPv4 addresses,
  268. check that the "-4" switch ("IPV4Only" in config file) is enabled.
  269. - If you upload script are enabled ("-o", or "CallUploadScript"), make sure
  270. that the pure-uploadscript is started. Or the FTP server will actually wait
  271. until pure-uploadscript is actually ready to process new uploads. If you don't
  272. need the uploadscript facility, remove "-o".
  273. * Double slash.
  274. -> Why do I see double slashes in log files? For instance, the path of a
  275. downloaded file looks like /home/john//pictures/zok.jpg .
  276. '//' is a symbol for the limit of the chroot jail. In that example, it means
  277. that John is caged in /home/john/ .
  278. * ftpwho as a non-root user.
  279. -> How do I give access to the 'pure-ftpwho' command to non-root users?
  280. The 'pure-ftpwho' command is restricted to root by default, because users
  281. probably shouldn't be given the ability to spy what other users are doing on
  282. the same host. However, it's safe to put the setuid bit on that command, in
  283. order to have it work as any user:
  284. chmod 4711 /usr/local/sbin/pure-ftpwho
  285. * Changing bandwidth throttling on-the-fly.
  286. -> Is it possible to change the bandwidth allocated to a user during a
  287. transfer, so that the change takes place immediately?
  288. Unfortunately, no. Or at least not at pure-ftpd level. Doing so would need
  289. to re-read user's parameters all the time and it would be horribly slow.
  290. Other mechanisms would work, like signals to interrupt transfers, re-read
  291. parameters, then resume. But it would introduce a lot of complexity to the
  292. code.
  293. If you're using a modern operating system like OpenBSD, ISOS or Linux,
  294. your kernel already includes a fair TCP/IP traffic shaper. And because it
  295. works at kernel-level, you can easily change the bandwidth allowed to IPs or
  296. services on-the-fly. Have a look at pf.conf(5) OpenBSD, ISOS and FreeBSD 5,
  297. and at tc (or read the Linux networking HOWTO) on Linux.
  298. Also see the 'Global bandwidth limitation' section later in this document.
  299. * KERBEROS_V4 rejected as an authentication type.
  300. -> It works and I can log in, but I receive these strange error messages at
  301. log in, even in a non-chrooted environment:
  302. 220 FTP server ready.
  303. 502 Security extensions not implemented
  304. 502 Security extensions not implemented
  305. KERBEROS_V4 rejected as an authentication type
  306. Why and what do they mean?
  307. This is a Linux-specific instllation issue. It means that your command-line
  308. FTP client isn't a normal one, but a Kerberos FTP client. You probably
  309. installed RPMs for Kerberos, although you don't use it. These messages are
  310. harmless as Kerberos clients will fallback to normal FTP (after these
  311. errors), but you just have to deinstall Kerberos on your client host to have
  312. 'ftp' work without these messages.
  313. * Wrong group ownership.
  314. -> I have a user called 'john' whose group is 'johngroup'. When John
  315. uploads a file, that one belongs to 'john', but to another group like
  316. 'wheel' (whose John isn't a member of). What's wrong?
  317. This is a BSD standard behavior (verified on OpenBSD, ISOS, DragonflyBSD and
  318. FreeBSD): when a new file is created, the group is inherited from the parent
  319. directory. On other systems (like GNU/Linux), files are owned by the primary
  320. group of the user, unless the directory has the setgid bit set.
  321. If you want new files uploaded in John's directory to belong to group
  322. 'johngroup', have that directory (and probably also subdirectories) belong
  323. to 'johngroup':
  324. chgrp -R johngroup /home/john
  325. * Compilation with MySQL.
  326. -> I can't compile with MySQL. ./configure says that MySQL libraries aren't
  327. properly installed.
  328. The libmysqlclient.so file should be in a path known by your dynamic linker.
  329. For instance, on a GNU/Linux system, add the path to libmysqlclient.so file
  330. (only the path, not the file itself) to /etc/ld.so.conf . Then, run
  331. 'ldconfig' .
  332. * "Sorry, I can't trust you".
  333. -> When a user tries to log in, he gets "Sorry, I can't trust you". But his
  334. login/password pair is right. What wrong?
  335. That message can means two things:
  336. - The user has a shell that isn't listed in /etc/shells. You must add it,
  337. even if it's a fake shell like /bin/false . Also make sure that you have a
  338. carriage return after the last entry in /etc/shells.
  339. - You are using the -u <uid> option to deny access to users whose uid is
  340. below <uid> . But the user you are trying to log in as, has an uid in the
  341. forbidden range.
  342. * Customer-friendly configuration.
  343. -> What switches do you recommend to start the server, for an hosting service?
  344. Here's a good start:
  345. --chrooteveryone \
  346. --maxclientsperip=5 \
  347. --displaydotfiles \
  348. --noanonymous \
  349. --minuid=100 \
  350. --umask=022:022 \
  351. --limitrecursion=10000:3 \
  352. --customerproof
  353. * Anonymous FTP with virtual users.
  354. -> I successfully created a virtual user called 'ftp' or 'anonymous', but
  355. anonymous FTP doesn't work.
  356. Pure-FTPd never fetch any info from the virtual users backends (puredb,
  357. MySQL, LDAP, etc) for anonymous sessions. There are three reasons not to do
  358. so: - Speed: do we need to query a database just to get the anonymous
  359. user's home directory? We don't need to retrieve any password for anonymous
  360. sessions.
  361. - Consistency: with the virtual hosting mechanism.
  362. To run an anonymous FTP server you must have a *system* account called
  363. 'ftp'. Don't give it any valid shell, just a home directory. That home
  364. directory is the anonymous area.
  365. * A basic setup.
  366. -> I'm trying to set up a ftp server just for me and my family so we can get
  367. and upload files when on the road. How can I make two users, say Jane and
  368. Joe, who share the directory /home/ftp and /home/ftp/incoming. In /home/ftp
  369. they only have read privs. and in /home/ftp/incoming they have read and
  370. write privs.
  371. Add a group for all FTP users (not mandatory, but more secure):
  372. groupadd ftpgroup
  373. Add an uid for all FTP users (idem, not mandatory, but better):
  374. useradd -g ftpgroup -d /dev/null -s /etc ftpuser
  375. Now, let's create /home/ftp and /home/ftp/incoming:
  376. mkdir -p /home/ftp/incoming
  377. chown -R root:ftpgroup /home/ftp/incoming
  378. chmod -R 755 /home/ftp
  379. chmod -R 1775 /home/ftp/incoming
  380. Let's add Jane:
  381. pure-pw useradd jane -m -u ftpuser -d /home/ftp
  382. Let's add Joe:
  383. pure-pw useradd joe -m -u ftpuser -d /home/ftp
  384. Let's start the FTP server:
  385. /usr/local/sbin/pure-ftpd -lpuredb:/etc/pureftpd.pdb -H -B
  386. Everything should be ok now.
  387. For more info about how to create new users, change passwords, etc.:
  388. http://www.pureftpd.org/README.Virtual-Users
  389. * Slow pure-ftpwho or slow login.
  390. -> Sometimes, pure-ftpwho is slow to show the result. And sometimes, when an
  391. user logs in, the session stucks a bit before he can get a directory listing.
  392. This is probably caused by a slow DNS resolver. In order to display full
  393. host names, pure-ftpd has indeed to make DNS queries that can be slow if you
  394. link is slow, or if the client link is slow.
  395. You can speed up pure-ftpwho and pure-ftpd with the -H switch. Names won't
  396. be resolved, you will see IP addresses instead.
  397. * Chrooted users can follow symlinks outside the chroot jail?
  398. -> People can create symbolic links to '/' and escape their home directory!
  399. There are two chroot implementations in pure-ftpd:
  400. - The traditional one, based upon your kernel chroot() system call. This
  401. is the default. With that one, symbolic links can only point inside the
  402. chroot jail, or they won't be followed.
  403. - The 'virtual chroot' implementation. With that feature, users *can*
  404. follow all symbolic links, even when they don't point inside the jail. This
  405. is very handy to set up directories shared by multiple users. Binary
  406. packages are compiled with virtual chroot by default.
  407. To enable the virtual chroot feature when you are compiling the server, use
  408. the --with-virtualchroot with ./configure . If you want a restricted chroot,
  409. don't include --with-virtualchroot.
  410. Please note that the FTP server will never let people create new symbolic
  411. links. Symbolic links have to be already there to be followed. Or if your
  412. users can create symbolic links through Perl or PHP scripts, your hosting
  413. platform is really badly configured. People can install any web file
  414. browser, they don't need FTP to look at your system files. Recompile PHP
  415. without POSIX functions and run all Perl scripts chrooted.
  416. * How to start Pure-FTPd in background.
  417. -> I start 'pure-ftpd' from an X terminal and the server properly
  418. answers. However, as soon as I close the terminal, the server stops.
  419. This is a shell dependent issue. Your shell is configured to close all
  420. background jobs when leaving. You can change your shell options
  421. (probably with a 'set' directive) or detach background jobs with the
  422. 'disown' keyword. Alternatively, you can just start pure-ftpd with the
  423. -B switch in order to have it detach at startup time:
  424. /usr/local/sbin/pure-ftpd -B
  425. * Windows command-line FTP client and 'ls'.
  426. -> With the command-line Windows FTP client, 'ls -la' doesn't return
  427. any file.
  428. The 'ls' command of an FTP client has nothing to do with the 'ls' command
  429. started from an Unix shell.
  430. With the command-line Windows client, typing 'ls' really sends the FTP
  431. command 'NLST'. So when you type 'ls -la', it doesn't mean 'verbosely
  432. list all files'. According to RFCs, it means 'list the file called -la' .
  433. So you get what you asked for. If no file is called '-la', you get nothing.
  434. If you want to play with regular expressions and switches, you should
  435. type 'dir' (which is translated to 'LIST') instead. 'dir -la' is ok.
  436. This is a bit illogical and that brain damage is specific to
  437. Microsoft's command-line FTP client.
  438. If you really want 'ls' to parse options, you can start pure-ftpd with
  439. the -b (broken) switch.
  440. * Global bandwidth limitation.
  441. -> How do I limit the *total* bandwidth for FTP?
  442. Pure-FTPd can limit bandwidth usage of every session. But limiting the total
  443. bandwidth is intentionally not implemented, because most operating systems
  444. already have very efficient algorithms to handle bandwidth throttling.
  445. Here's an example with Linux.
  446. 1) Have a look at /proc/sys/net/ipv4/ip_local_port_range. You will see two
  447. numbers: this is the interval of local ports your Linux kernel will use for
  448. regular outgoing connections. The FTP ports you have to reserve for passive
  449. FTP must *not* be in this range. So if:
  450. "cat /proc/sys/net/ipv4/ip_local_port_range" returns "32768-61000", you can
  451. reserve ports 10000 to 20000 for your FTP server, but not 30000 to 40000.
  452. (alternatively, you can change the local port range) .
  453. 2) Change the first lines and save the following script:
  454. ---------------------------- Cut here ----------------------------
  455. #! /bin/sh
  456. # Simple bandwidth limiter - <j at pureftpd.org>
  457. # Change this to your link bandwidth
  458. # (for cable modem, DSL links, etc. put the maximal bandwidth you can
  459. # get, not the speed of a local Ethernet link)
  460. REAL_BW='10Mbit'
  461. # Change this to the bandwidth you want to allocate to FTP.
  462. # We're talking about megabits, not megabytes, so 80Kbit is
  463. # 10 Kilobytes/s
  464. FTP_BW='80Kbit'
  465. # Change this to your physical network device (or 'ppp0')
  466. NIC='eth0'
  467. # Change this to the ports you assigned for passive FTP
  468. FTP_PORT_LOW="10000"
  469. FTP_PORT_HIGH="20000"
  470. tc qdisc add dev "$NIC" root handle 1: cbq \
  471. bandwidth "$REAL_BW" avpkt 1000
  472. tc class add dev "$NIC" parent 1: classid 1:1 cbq bandwidth "$REAL_BW" \
  473. rate "$REAL_BW" maxburst 5 avpkt 1000
  474. tc class add dev "$NIC" parent 1:1 classid 1:10 cbq \
  475. bandwidth "$REAL_BW" rate "$FTP_BW" maxburst 5 avpkt 1000 bounded
  476. tc qdisc add dev "$NIC" parent 1:10 sfq quantum 1514b
  477. tc filter add dev "$NIC" parent 1: protocol ip handle 1 fw flowid 1:10
  478. iptables -t mangle -A OUTPUT -p tcp --sport 20:21 -j MARK --set-mark 1
  479. iptables -t mangle -A OUTPUT -p tcp \
  480. --sport "$FTP_PORT_LOW":"$FTP_PORT_HIGH" -j MARK --set-mark 1
  481. ---------------------------- Cut here ----------------------------
  482. 3) Make sure that you have the 'tc' command installed. If your Linux distro
  483. doesn't ship 'ip' and 'tc' commands, it really sucks and you must install a
  484. package called 'iproute2' to get them.
  485. 4) Start Pure-FTPd with the passive port range you assigned:
  486. /usr/local/sbin/pure-ftpd -p 10000:20000 -HBA
  487. 5) Run the script you created in step 2. It it doesn't work, check that QOS
  488. support was compiled in your Linux kernel.
  489. 6) Enjoy :)
  490. Also have a look at :
  491. http://www.docum.org
  492. http://www.shorewall.net/traffic_shaping.htm and
  493. http://talk.trekweb.com/~jasonb/articles/linux_tc_minihowto.shtml
  494. * Linux, NTFS and Pure-FTPd.
  495. -> On Linux, I can't transfer files from an NTFS partition.
  496. Keep in mind that the NTFS filesystem is still an experimental beast in
  497. Linux. Some basic operations are not implemented yet. Fortunately, a big
  498. effort is being made and Linux 2.5 has a new NTFS implementation that fully
  499. works with Pure-FTPd (try ./configure --without-sendfile, though) . And it
  500. is more reliable and really faster than the old one. And even more
  501. fortunately, the new NTFS implementation has been backported to recent 2.4.x
  502. kernels. Have a look at http://linux-ntfs.sf.net/ .
  503. * Slowdowns and lags.
  504. -> Some users complains that transferring large files doesn't work. Transfers
  505. are starting as expected, with a decent rate. But then, the speed dramatically
  506. decreases, there are some serious lags and they often must disconnect (or the
  507. client force them to do it, after a timeout) . The server is behind a firewall
  508. that filters incoming ICMP, but let FTP ports in.
  509. Don't, don't, don't filter ICMP. At least not blindly without understanding
  510. what you are filtering. ICMP is part of the TCP/IP specifications. Filtering
  511. it can have nasty side effects with no real win. If you even filter ICMP types
  512. 3 and 4, your firewall is definitely broken and this is probably why you have
  513. such troubles with transfers of large files.
  514. Please read these documents about ICMP filtering :
  515. http://www.phildev.net/mss/index.html
  516. http://alive.znep.com/~marcs/mtu/
  517. http://www.freelabs.com/~whitis/isp_mistakes.html
  518. Also some hardware routers don't properly handle window scaling. Try
  519. to turn it off, for instance on Linux:
  520. sysctl -w net.ipv4.tcp_window_scaling=0
  521. sysctl -w net.ipv4.tcp_bic=0
  522. * Firewalls and TLS.
  523. -> My client is behind a stateful firewall doing applicative filtering (like
  524. IPTables with ip_conntrack_ftp or ip_nat_ftp) . Connections to an TLS
  525. enabled server doesn't work. Authentication works, but I'm unable to download
  526. files nor list directories.
  527. First, try to force your client to use the passive mode. In active mode, the
  528. server has to connect to the client (or the NAT gateway) on a dynamic port
  529. that is negotiated on the connection socket. But when TLS is used, that
  530. connection socket is encrypted, therefore no man-in-the middle can see what
  531. ports will be used to transfer data, including the firewall. There are some
  532. proposals to work around this problem, but neither popular clients nor common
  533. firewalls are aware of these tricks. Therefore, use the passive mode or switch
  534. to SSH.
  535. * TLS and error 00000000.
  536. -> My TLS-enabled client doesn't work. It outputs something like :
  537. "SSL connect: error:00000000:lib(0):func(0):reason(0)". What does it mean?
  538. This error is not very explicit. You get it from some Unix clients like LFTP.
  539. It actually means that there is a firewall or a NAT box between a TLS-enabled
  540. server and a TLS-enabled client, but that firewall is unable to handle
  541. encrypted FTP sessions. Unfortunately, there's no simple workaround against
  542. this. Try to switch your client to active mode and use 1:1 NAT, but TLS,
  543. firewalls and FTP don't mix very well.
  544. * Slow TLS operations.
  545. -> When clients connect with TLS encryption, listing directories and
  546. downloading files are slow operations. Nothing happens after a command is
  547. sent, things only start moving after a 5 secondes delay.
  548. Check the host name of your certificate. It should be a fully-qualified host
  549. name and if possible, it shouldn't be a CNAME entry.
  550. Also check your DNS cache servers.
  551. * Files getting renamed automatically
  552. (submitted by C. Jon Larsen)
  553. -> Sometimes when files get uploaded they are getting renamed to something
  554. like "pureftpd.3f3300d2.33.0001". What is causing this ?
  555. The ftp client that is being used to upload the files is using the STOU (Store
  556. Unique) FTP command instead of the STOR FTP command. If you check the ftp
  557. logfile you should see something like this in the logs:
  558. (user@a.b.c.d) [DEBUG] Command [stou] [file_name_from_the_client.ext]
  559. /var/ftp/ftpcustomer/pureftpd.3f3300d2.33.0001 uploaded (218168 bytes,
  560. 127.79KB/sec)
  561. The STOU command tells the ftp client to begin the transmission of the file to
  562. the remote site; the remote filename picked by the ftp server will be unique
  563. within in the current directory that the ftp client is using. The response
  564. from the server will include the filename.
  565. The ftp client has an option like "create unique files" or "upload file with a
  566. temporary name" enabled. You should have the ftp user uncheck this option.
  567. Trying to disable the STOU command on the server side is not a good idea or
  568. solution as some ftp clients will use STOU to upload a file with the
  569. temporary, unique name, and then rename the file once the upload is complete.
  570. This helps prevent failed uploads from leaving partial files around.