⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 功能强大的ftp服务器源代码
💻
📖 第 1 页 / 共 5 页
字号:
With that feature, every account on the server can have its own publicanonymous FTP area. If you are providing hosting services, this is a nicefeature for your customers.* WARNING *: it also means that your customers can create "incoming"directories with 1777 permissions. It can be nice, but it can also fill upyour disk with warez. You can stop uploads for anonymous users with the'-i' (or --anonymouscantupload) option.By default, all IP addresses assigned to your server can be accessed by realor anonymous users. You can restrict this with -e (only anonymous) or -E(only real) .A more flexible way is to use '-V <ip address>' to define a "trusted" IPaddress. When a client connects to that trusted IP, anonymous and reallogins are permitted. But on all other IP, only anonymous users are permitted.If you are a hosting service provider and if each customer has its own IPaddress, it may be a nice idea to have a trusted IP you give to all yourcustomers, so that they can manage the files in their account. That IP isthe same for all customers. You can easily restrict access to that IP withfirewall rules if your customers have static IP addresses.Use '-V <trusted ip>' and link /etc/pure-ftpd/<customer ip> to~customer/ftp . Every customer will have his own *anonymous only* FTPserver and hackers will have to find the trusted IP to get in.       ------------------------ IPv6 SUPPORT ------------------------Pure-FTPd has full IPv6 support (native IPv6 addresses and 4-in-6addresses). But use a super-server that also understands the IPv6 protocol,like Rlinetd or Xinetd. Recent versions of Inetd should also be ok(unverified). IPv6 is supported everywhere: logging, configurationswitches, virtual hosts, protocol (EPSV/EPRT support), name resolution...             --------------------- LOGGING ---------------------Log messages are sent to the syslog daemon. You can disable logging with'-f none'.If you want all FTP messages to be redirected to a file, say /var/log/ftp,add this line to your /etc/syslog.conf file:ftp.*   /var/log/ftpThen restart your syslogd daemon:killall -HUP syslogdYou can also drop your old "syslogd" and "klogd" programs for Metalog, anefficient alternative: http://metalog.sourceforge.net/Names of uploaded/downloaded files are logged with paths like this:                           /home/ftp//pub/bla.jpg                           The double-slash ('//') is the chroot limit.    --------------------- WATCHING CURRENT SESSIONS ---------------------Since 0.97.7, you can type 'pure-ftpwho' at any time to watch current activesessions.If typing 'pure-ftpwho' answers 'Command not found', you have to add/usr/local/sbin in your PATH environment variable.The default output looks like this:+------+---------+-------+------+-------------------------------------------+| PID  |  Login  |For/Spd| What |                 File/IP                   |+------+---------+-------+------+-------------------------------------------+| 2239 | jedi    | 00:17 |  D/L | XFree86-clients-4.0.3.tar.gz              ||  ''  |    ''   |  41K/s|  33% | ->                     nestea.funboard.de |+------+---------+-------+------+-------------------------------------------+| 2385 | ftp     | 00:02 | IDLE |                                           ||  ''  |    ''   |       |      | ->                     gw2.crn.kjop.co.uk |+------+---------+-------+------+-------------------------------------------+'D/L' means that the client is downloading and 'U/L' means he's uploadingsome file whose name is shown in the next column. '33%' is the real-timecompletion of the current operation. '41K/s' is the bandwidth used by theclient. You can track down who's starving your bandwidth with this.The 'pureftp-who' command accepts interesting options:'-c': the program is called via a web server (CGI interface) . Output is afull HTML page with the initial content-type header. This option isautomatically enabled if an environment variable called GATEWAY_INTERFACE isfound. This is the default if you can access the program from a CGI-enabled webserver (Apache, Roxen, Caudium, WN, ...) .'-h': show command-line options summary.'-n': don't resolve host names and only show IP addresses (faster).'-s': output an easily parsable format for shell scripts (but not very userfriendly) . There's only one line per client, with only numeric data, delimited by a '|'character. It's not very human-readable, but it's designed for easy parsing byshell scripts (cut/sed) . '|' characters in user names or file names arequoted ('|' becomes '\|') .Type 'pure-ftpwho -h' to check the format. '-w': output a complete HTML page (web mode).'-W': output an HTML page with no header and no footer. This is an embeddedmode, suitable for inline calls from CGI, SSI or PHP scripts.'-x': output well-formed XML data for post-processing. This is the mostacurate mode. Time is in seconds and file sizes are in bytes (in otheroutput formats, sizes are in kbytes for easier readability) .'-v': verbose output in text mode. Additional info includes the size offiles being downloaded/uploaded, the local IP or local host name and theconnection port. This is especially useful for virtual hosts. Here's asample output of 'pure-ftpwho -v':+------+---------+-------+------+-------------------------------------------+| PID  |  Login  |For/Spd| What |     File/Remote IP/Size(Kb)/Local IP      |+------+---------+-------+------+-------------------------------------------+| 9086 | j       | 00:04 |  DL  | linux-2.4.4.tar.bz2                       ||  ''  |    ''   |  22K/s|  27% | ->                              localhost ||  ''  |    ''   |       |      | Total size:    20859 Transfered:     5632 ||  ''  |    ''   |       |      | <-                        localhost:21    |+------+---------+-------+------+-------------------------------------------+      ------------------------ AFTER AN UPLOAD ------------------------After a successful upload, any external program or shell script can bespawned with the name of the newly uploaded file as an argument. You can usethat feature to automatically send a mail when a new file arrives. Or youcan pass it to a moderation system, an anti-virus, a MD5 signature generatoror whatever you decide can be done with a file.To support this, the server has to be configured --with-uploadscript atcompilation time. Then, the FTP server has to be launched with the '-o'run-time option. Finally, you have to run another daemon called'pure-uploadscript' provided by this package.IMPORTANT:YOU MUST START PURE-FTPD _FIRST_ and _THEN_ START PURE-UPLOADSCRIPT.THE REVERSE ORDER WON'T WORK.For security purposes, the server never launches any external program. It'swhy there is a separate daemon, that reads new uploads pushed into a namedpipe by the server. Uploads are processed synchronously and sequencially.It's why on loaded or untrusted servers, it might be a bad idea to usepure-uploadscript with lenghty or cpu-intensive scripts.The easiest way to run pure-uploadscript is 'pure-uploadscript -r <script>':/usr/local/sbin/pure-uploadscript -r /bin/antivirus.shThe absolute path of the newly uploaded file is passed as a first argument.Some environment variables are also filled with interesting values:- UPLOAD_SIZE  : the size of the file, in bytes.- UPLOAD_PERMS : the permissions, as an octal value.- UPLOAD_UID   : the uid of the owner.- UPLOAD_GID   : the group the file belongs to.- UPLOAD_USER  : the name of the owner.- UPLOAD_GROUP : the group name the file belongs to.- UPLOAD_VUSER : the full user name, or the virtual user name. (127 chars max)There are also some options to "pure-uploadscript":- '-u <uid>' and '-g <gid>' to switch the account pure-uploadscript will runas. The script will be spawned with the same identity.- '-B' to fork in background.Please have a look at the man page ('man pure-uploadscript') for additionalinfo.    ------------------------ LISTING DIRECTORIES ------------------------The built-in 'ls' supports all common options of a regular 'ls' command.Here are the ones you should know for a better life with FTP:- '-l': verbose listing, reporting dates, owners, perms and sizes.- '-a': also lists files and directories beginning with a dot.- '-F': adds a '/' after directory names.- '-d': list the directory itself, not its content.- '-R': recursive listing.- '-S': sort by size.- '-t': sort by date.- '-r': reverse the sorting order.If you aren't very familiar with Unix, log in to your FTP server and trythese variants:lsls -Fls -lls -lals -lRls -Slls -Slrls -tlls -tlrGlobbing is also supported. So if you are looking for a GNOME RPM in<I don't know the directory name>/gnome-xxxxxxxx.rpm , you can find it thatway:ls */gnome*.rpm      ------------------------ VIRTUAL QUOTAS ------------------------With virtual quotas, you can restrict the maximum number of files and thetotal size of a user directory.These quotas are "virtual" because they aren't handled at kernel-level, butby the FTP server itself. There are some advantages over kernel quotas:- Virtual quotas are specific to the FTP server. You can have differentsystem quotas to handle other files (eg. mail) on the same partition.- You can have different virtual quotas for every user, even if they sharethe same system uid.- Virtual quotas are working even on filesystems that don't support systemquotas.However, virtual quotas are slower and can't be as reliable as kernel quotas,so don't trust them ultimately, they are probably races allowing to bypassthem. Also the filesystem users directories are on must properly support filelocking.Virtual quotas are implemented in Pure-FTPd as simple files called".ftpquota", located in the home directory of chrooted users. This file onlycontains two numbers: the current number of files for this user and thetotal size of the directory (+ its subdirectories), in bytes. When a newfile is uploaded, these numbers grow. When a file is deleted, these numbersget smaller. Simple. Of course, when virtual quotas are enabled for oneuser, that user must be 1) chrooted, 2) not allowed to write quota files, 3)not allowed to forbid access to some directories to fool the counter.Quotas can be enabled for all users for the -n (--quotas) option. Thisoption is followed by the max number of files and the max size (in Megabytes). Every user will have the same quota. Exception: members of the trustedgroup, if -a is enabled.You can also have different quotas for every user if you use PureDB or SQLdatabases. See the "README.Virtual-Users" file for more info about PureDBdatabases.So, if you want 1000 files max and 10 Mb max for all your customers, runthe server like this:/usr/local/sbin/pure-ftpd -n 1000:10".ftpquota" files are created on demand when they are missing. However, whenthey are created, the server assumes that the account was empty. If this isnot the case, you must run the "pure-quotacheck" utility to create aninitial ".ftpquota" file."pure-quotacheck" is a tool that computes the size and the number of filesin a directory and create a ".ftpquota" file with this info.The syntax is:pure-quotacheck -u username/uid -d home directory [-g group/gid]For instance, if you want to summarize usage for the /home/ftpusers/johndirectory, whoose files are owned by the "ftpusers" system account, just run:pure-quotacheck -u ftpusers -d /home/ftpusers/johnYou can run pure-quotacheck whenever you want, even when ".ftpquota" filesare already there. This is even a good idea to run this for all users incrontab, so that stored quotas are always exact, even if something went wrong(server bug, filesystem corruption, savagely killed server, etc) .       With traditional quotas, when a hard limit is reached, it's impossible towrite new data. It's nice for files that are created fastly (operations onlocal filesystems) . But it's really frustrating when transfering filesthrough networks.Virtual quotas are working in a (somewhat strange) but handy way. When anuser begins an upload, the newly uploaded file can be as huge as his totalquota. It means that if his quota is 10 Mb, he can upload a 10 Mb file, evenif he already has 9 Mb of other files in his directory. The idea is thatwhile he's uploading the file, he can realize that his quota will bereached and he can move/compress/delete other files to save space beforethe end of the upload. And only after completion of the upload, the quota ischecked. If the quota is still crunched, the newly uploaded file will bedeleted.      ------------------------ AUTHENTICATION ------------------------Pure-FTPd supports multiple methods of authentication. To use a method, youmust have it compiled in (check the ./configure options) .- To use Unix authentication (the traditional /etc/passwd file), add thefollowing option when you run the server:                                   -l unix- To use PAM authentication, add this:                                   -l pam                                                                      - To use PureDB (virtual

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -