快速业务通道

使特定网段用户能自由上传下载的方法总结

作者 佚名技术 来源 服务器技术 浏览 发布时间 2012-07-05

在FC3上用vsftp实FTP服务。由于一些网段的用户为内部成员,不会对服务器造成危害。为了减少麻烦,更好地实现资源共享,现在想给他们的网段(本例中以10.0.1.*为例)的用户以自由上传下载的权利。

涉及的配置文件一共有四个:

vsftpd.conf

hosts.allow

/etc/vsftpd/local.class

/etc/vsftpd/other.class

内容:

hosts.allow

[code:1:14158339dc]#

#hosts.allow Thisfiledescribesthenamesofthehostswhichare

# allowedtousethelocalINETservices,asdecided

# bythe''/usr/sbin/tcpd''server.

vsftpd:10.0.1.*:setenvVSFTPD_LOAD_CONF/etc/vsftpd/local.class

vsftpd:ALL:setenvVSFTPD_LOAD_CONF/etc/vsftpd/other.class[/code:1:14158339dc]

/etc/vsftpd/local.class

[code:1:14158339dc]write_enable=YES

anon_upload_enable=YES

anon_mkdir_write_enable=YES[/code:1:14158339dc]

/etc/vsftpd/other.class

[code:1:14158339dc]write_enable=NO

anon_upload_enable=NO

anon_mkdir_write_enable=NO[/code:1:14158339dc]

vsftpd.conf

[code:1:14158339dc]#Exampleconfigfile/etc/vsftpd/vsftpd.conf

#

#Thedefaultcompiledinsettingsarefairlyparanoid.Thissamplefile

#loosensthingsupabit,tomaketheftpdaemonmoreusable.

#Pleaseseevsftpd.conf.5forallcompiledindefaults.

#

#READTHIS:ThisexamplefileisNOTanexhaustivelistofvsftpdoptions.

#Pleasereadthevsftpd.conf.5manualpagetogetafullideaofvsftpd''s

#capabilities.

#

#AllowanonymousFTP?(Beware-allowedbydefaultifyoucommentthisout).

anonymous_enable=YES

#

#Uncommentthistoallowlocaluserstologin.

#不允许本地用户上传下载,即只允许基于ip的认证

#local_enable=YES

#

#UncommentthistoenableanyformofFTPwritecommand.

#在ftpd中的local.class和other.class文件中有write_enable=YES项

#write_enable=YES

#

#Defaultumaskforlocalusersis077.Youmaywishtochangethisto022,

#ifyourusersexpectthat(022isusedbymostotherftpd''s)

local_umask=022

#

#UncommentthistoallowtheanonymousFTPusertouploadfiles.Thisonly

#hasaneffectiftheaboveglobalwriteenableisactivated.Also,youwill

#obviouslyneedtocreateaDirectorywritablebytheFTPuser.

#anon_upload_enable=YES

#

#UncommentthisifyouwanttheanonymousFTPusertobeabletocreate

#newdirectories.

#anon_mkdir_write_enable=YES

#

#Activatedirectorymessages-messagesgiventoremoteuserswhenthey

#gointoacertaindirectory.

dirmessage_enable=YES

#

#Activateloggingofuploads/downloads.

xferlog_enable=YES

#

#MakesurePORTtransferconnectionsoriginatefromport20(ftp-data).

connect_from_port_20=YES

#

#Ifyouwant,youcanarrangeforuploadedanonymousfilestobeownedby

#adifferentuser.Note!Using"root"foruploadedfilesisnot

#recommended!

#chown_uploads=YES

#chown_username=whoever

#

#Youmayoverridewherethelogfilegoesifyoulike.Thedefaultisshown

#below.

xferlog_file=/var/log/vsftpd.log

#

#Ifyouwant,youcanhaveyourlogfileinstandardftpdxferlogformat

xferlog_std_format=YES

#

#Youmaychangethedefaultvaluefortimingoutanidlesession.

#idle_session_timeout=600

#

#Youmaychangethedefaultvaluefortimingoutadataconnection.

#data_connection_timeout=120

#

#Itisrecommendedthatyoudefineonyoursystemauniqueuserwhichthe

#ftpservercanuseasatotallyisolatedandunprivilegeduser.

#nopriv_user=ftps

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号