📄 upload.configuration.howto
字号:
But, if you do, there will be unintended consequences. In the example,we're trying to restrict upload privileges to just the ftpadmin's homedirectory. Consider, though, this will match all of the followingdirectories:/home/users/ftpadmin/home/users/ftpadmin/mirrors/home/users/ftpadministrationThis last directory isn't wanted. Instead use:upload /home/users/ftpadmin /home/users/ftpadmin yesto match the ftpadmin's home directory itself, then use:upload /home/users/ftpadmin /home/users/ftpadmin/* yesto match all subdirectories under the ftpadmin's home.umasks for guest and real users-------------------------------In most cases you will want to allow guest and real users to control thepermissions on their own files and directories. As in the examples shown,if there are no specific permissions given on upload clauses, any new filesor directories created will have all permissions set. umasks can be usedto reduce these permissions.The daemon has a command-line option (-u) to set the default umask for allusers. Follow the -u option with an octal permissions mask. Bits in thismask are permissions to turn off whenever the daemon creates a new file ordirectory. The manpage for ftpd documents the -u option.Often times, the global -u option is not sufficient. In the ftpaccessfile, you can control umasks by class by using the defumask clause. If noclass is given, defumask overrides the -u umask from the command line. Ifthe current user is a member of the named class, defumask overrides theumask setting for this user only.For example, assume there are several classes of usersclass admin real 10.0.0.0/8 127.0.0.0/8class local guest 10.0.0.0/8 127.0.0.0/8class remote guest *class anon anonymous *( Notice, by the way, in this example, real users will not be allowedaccess unless from the local network since they are not in any class whencoming from an outside IP address. Since the daemon gives no clue to theremote user in this case, to outside addresses it will appear as if theadmin users do not exist on the server. The specific cause for their loginfailure will appear in your system logs. )We can control the umask by class for these users. For example, we mightsay:defumask 0377defumask 0177 admindefumask 0133 local remoteThe first clause applies whenever another defumask clause does not matchthe current user's class. This is the same as adding '-u 0377' to thecommand line for the FTP daemon. In this case, the clause applies only toanonymous users since all other classes have specific default umasks given.The second turns off execute permissions, as well as group- and world- readand write permissions, for all files and directories created by real users(users in the admin class).The last rule turns off execute permissions and group- and world-writepermissions for files and directories created by guests (in the local andremote classes).Remember: umasks apply to ALL files and directories created EXCEPT thosewhere an upload clause applies AND the upload clause gives specificpermissions. Disabling execute permissions will cause problems using newlycreated directories; leaving them enabled is unsafe because all filesuploaded will have execute permission and could, therefore, be used inattempts to break into the server.I recommend disabling all execute permissions and instructing your users touse the chmod command to add execute permissions to directories or tochange the umask before creating directories. This may be a bit more workfor your users, but it is safer than having a Trojan Horse program markedexecutable just waiting for someone, possibly root, to try running it.umask and chmod command restrictions------------------------------------As just mentioned, users have the ability to change the current umask andmodify the permissions on files and directories.Obviously, you will want to disable this feature for anonymous users. Youmay also want to control who may use these features for your guest and realusers. The defaults should be acceptable for most sites. The defaultsettings are equivalent to the following (which you may want to add to yourftpaccess file so you don't forget):chmod no anonymouschmod yes real,guestumask no anonymousumask yes real,guestIf, for example, you wanted to disable these commands for guests accessingthe server from outside the local network, you could add the following:chmod no class=remoteumask no class=remoteBe sure to insert these _before_ the 'yes' clauses. Order is important;the daemon will apply the first matching rule it finds. If you dosomething like this, it is probably safer to rewrite the clauses to denyeverything but what you allow. For example:chmod yes real,class=localumask yes real,class=localchmod no guest,anonymousumask no guest,anonymousDelete, overwrite, rename restrictions--------------------------------------The daemon also provides control over the user's ability to delete, over-write and rename files. Again, the defaults are probably acceptable inmost cases. These are:delete no anonymousdelete yes real,guestrename no anonymousrename yes real,guestoverwrite no anonymousoverwrite yes real,guestAs with the chmod and umask clauses, you can control these by class aswell. Continuing the above example, restricting these to local users only,we could instead say:delete yes real,class=localrename yes real,class=localoverwrite yes real,class=localdelete no guest,anonymousrename no guest,anonymousoverwrite no guest,anonymousPer-class upload clauses------------------------Just as we can restrict the ability to change permissions, delete files,etc., we can also define upload clauses which apply only to specificclasses of users. For instance, with the classes from the above examples,we can revoke upload rights for remote guests.For example, we can deny all uploads the remote guests except to theirpersonal tmp directories:upload class=remote /home/users/* * noupload class=remote /home/users/* /*/tmp yes nodirsPrivate incoming areas----------------------Often times, users would like to have private areas in the FTP site.Sometimes, it is usefull to also have incoming areas in those privateareas. Examples of the permissions for private areas can be found in thelayout at ftp://ftp.wu-ftpd.org/pub/wu-ftpd/examples/ and, other thanownership, are no different than the public incoming area, so I'll simplypresent the upload clauses here.For this example, we'll allow anonymous uploads into all private incomingareas:upload /home/ftp /private/*/incoming yes * * 0440 nodirsupload /home/users/ftpadmin /home/ftp/private/*/incoming yes * * 0440 nodirsThe assumption here is Unix shell users have private areas in the anonymoussite. Those areas are owned by the appropriate user, and incoming filesare to be owned by that user. The wildcard match on directory allowsanonymous uploading to any private incoming directory. The wildcard forowning user and group instructs the daemon to set the file's ownership tothat of the directory receiving it.Don't forget, if you allow private incoming areas, they are open foranonymous access and you should take care to ensure a DoS attempt to fillthe file system cannot take out your entire server. Create a separatefilesystem for the private incoming areas or put them inside the publicincoming area.Differences from earlier versions---------------------------------This HOWTO was written for version 2.6.0 of the WU-FTPD server. Earlierversions used different rules for the upload clause.Some versions of the daemon required the first parameter to be the name ofthe root directory for the chroot. This allowed upload control by area,but did not provide for different rules on a per-user basis.Some versions of the daemon required the first parameter to be lexicallyidentical to the user's home directory entry. This was non-obvious and the'/./' was often forgotten.Some versions of the daemon got totally confused, attempted to apply boththese methods at once, and ended up ignoring all your upload rules. If youwere smart, you had your permissions set properly and didn't notice.Early versions of the VR upgrades, and all earlier versions of the daemon,allowed file system modification as the default for all users. The currentversion does not allow any modification commands (ie., upload, delete,rename) by anonymous users unless specifically granted in the ftpaccessfile.Early versions of the VR upgrades, and all earlier versions of the dameon,had no method for specifying the permissions for a newly created directory.Also, they required exact matches for the first parameter (no globbing) andexact user and group names or numbers for ownership file files anddirectories.-- Gregory A Lundberg WU-FTPD Development Group1441 Elmdale Drive lundberg@wu-ftpd.orgKettering, OH 45409-1615 USA 1-800-809-2195
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -