当前位置: 首页 > 图文教程 > 服务器 > Linux服务器 > VSFTPd自架Linux网络服务器方法

Linux服务器
linux下用cron定时执行任务的方法
.htaccess绑定域名到子目录的方法
linux apache下虚拟主机配置方法
apache 局域网访问配置方案
linux Apache服务器系统安全设置与优化
linux中mac地址绑定方法
linux托盘不断闪烁之解决方法
Apache配置 虚拟转向实例
Apache No space left on device的解决办法
Apache rewrite的重写相关的参数说明
LINUX入门级常用命令20条整理
Ubuntu设置开机自动挂载所有格式硬盘分区
5个可能被你忽略的Linux安全设置方法
学习Apache的mod rewrite、access写法
改版时保留原链接,创建新的URL的方法
rsync中文手册之使用rsync实现网站镜像和备份linux
rsync 数据同步使用详解
linux URL的301重定向代码分析
eclipse3.2.2 + MyEclipse5.5 + Tomcat5.5.27 配置数据库连接池
Apache服务器二级域名的完美实现

Linux服务器 中的 VSFTPd自架Linux网络服务器方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-18   浏览: 83 ::
收藏到网摘: n/a

1。操作环境是Redhat9.0,vsFTPd的版本是Redhat9.0所带的vsftpd-1.1.3-8.i386.rpm,在安装盘的第三张中

2。vsFTPd实现的最基本的目的:用系统中存在的真实用户能登入FTP,能用匿名访问。

3。vsFTPd运行模式是在standalone模式下运行的,也就是说,本帖中vsFTPd所有的功能都是在standalone模式下运行的。至于有些功能是否能在xinetd模式下运行,您就得测试了,不能照搬照抄。因为有些功能是必须运行在特定的模式下的。

3。服务器的IP和和DNS设定

第一块网卡
IP:192.168.0.1
子掩码:255.255.255.0
网关不设置:
第二块网卡:
IP:192.168.0.2
子掩码:255.255.255.0
网关不设置

因为我的操作环境是一个小型的局域网,所以其它的机器的IP都是在192.168.0这个网段上。ADSL是接在服务器的第一个网卡上。服务器的第二个网卡是接集线器,其它的客户机都是接在集线器上。为了能让ADSL访问internet,因为自己手动设置了IP,所以DNS也要自己来设置,DNS如下:

202.96.134.133
202.96.168.68

设置工具是:
[root@linuxsir001root]#redhat-config-network

一。用vsFTPd来架设FTP服务器,vsFTPd服务器是目前最好的FTP服务器软件,优点是体积小,可定制强,效率高

1。查看是否安装了vsFTPd软件
[root@linuxsir001root]#rpm-qa|grepvsftpd
如果没有任何显示,说明没有把vsFTPd安装上,如果出现的是下面的这样的提示,就证明已经安装上了。

[root@linuxsir001root]#rpm-qa|grepvsftpd
vsftpd-1.1.3-8

我以Redhat9.0,以其自带的vsFTPd包vsftpd-1.1.3-8版本来为本帖约定。

[root@linuxsir001root]#rpm-ivhvsftpd*.rpm

2。打开vsFTPd服务器。

[root@linuxsir001root]#ntsysv

把vsftpd服务器打开,也就是在运行ntsysv命令后,把vsftpd服务选中。


vsftpd

3。运行/etc/init.d/vsftpdstart

[root@linuxsir001root]#/etc/init.d/vsftpdstart
为vsftpd启动vsftpd:[确定]
[root@linuxsir001root]#

4。配制vsFTPd,vsFTPd的运行有两种模式,一种是standalone"initd"模式,另外一种是xinetd模式,上面我们所说的就是standalone"initd"运行模式。两种模式运行机制不是相同的,stardardinitd模式,适合专业FTP,且FTP总是一直有人访问,占用资源也是比较大,如果您的FTP总是有人访问和登入。就要用这种模式。如果您的FTP访问人数比较小,建议您用xinetd模式。xinetd模式,是当用户请求时,vsFTPd才会启动。



不同的环境,当然得用不同的启动模式。

1]我们主要把vsFTPd的配制文件改一下就行了。配制文件在/etc/vsftpd/vsftpd.conf,用您喜欢的编辑器打开。请参考下面的配制文件。

#Exampleconfigfile/etc/vsftpd.conf
#
#Thedefaultcompiledinsettingsareveryparanoid.Thissamplefile
#loosensthingsupabit,tomaketheftpdaemonmoreusable.
#
#AllowanonymousFTP?
anonymous_enable=YES
#
#Uncommentthistoallowlocaluserstologin.
local_enable=YES
#
#UncommentthistoenableanyformofFTPwritecommand.
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=ftpsecure
#
#EnablethisandtheserverwillrecogniseasynchronousABORrequests.Not
#recommendedforsecurity(thecodeisnon-trivial).Notenablingit,
#however,mayconfuseolderFTPclients.
#async_abor_enable=YES
#
#BydefaulttheserverwillpretendtoallowASCIImodebutinfactignore
#therequest.TurnonthebelowoptionstohavetheserveractuallydoASCII
#manglingonfileswheninASCIImode.
#Bewarethatturningonascii_download_enableenablesmaliciousremoteparties
#toconsumeyourI/Oresources,byissuingthecommand"SIZE/big/file"in
#ASCIImode.
#TheseASCIIoptionsaresplitintouploadanddownloadbecauseyoumaywish
#toenableASCIIuploads(topreventuploadedscriptsetc.frombreaking),
#withouttheDoSriskofSIZEandASCIIdownloads.ASCIImanglingshouldbe
#ontheclientanyway..
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
#Youmayfullycustomisetheloginbannerstring:
#ftpd_banner=WelcometoblahFTPservice.
#
#Youmayspecifyafileofdisallowedanonymouse-mailaddresses.Apparently
#usefulforcombattingcertainDoSattacks.
#deny_email_enable=YES
#(defaultfollows)
#banned_email_file=/etc/vsftpd.banned_emails
#
#Youmayspecifyanexplicitlistoflocaluserstochroot()totheirhome
#directory.Ifchroot_local_userisYES,thenthislistbecomesalistof
#userstoNOTchroot().
#chroot_list_enable=YES
#(defaultfollows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
#Youmayactivatethe"-R"optiontothebuiltinls.Thisisdisabledby
#defaulttoavoidremoteusersbeingabletocauseexcessiveI/Oonlarge
#sites.However,somebrokenFTPclientssuchas"ncftp"and"mirror"assume
#thepresenceofthe"-R"option,sothereisastrongcaseforenablingit.
#ls_recurse_enable=YES

pam_service_name=vsftpd
userlist_enable=YES
#enableforstandalonemode
listen=YES
tcp_wrappers=YES

2]更改完配制文件后,我们可以用下面的命令来重启vsFTPd服务器

[root@linuxsir001root]#/etc/init.d/vsftpdrestart
关闭vsftpd:[确定]
为vsftpd启动vsftpd:[确定]
[root@linuxsir001root]#

3]以匿名方式来访问测试,在text模式下:

注意:在text模式下,要用用户名ftp,密码ftp来访问,这才是在text中匿名访问FTP。看如下的操作:

[root@linuxsir001root]#ftp192.168.0.1
Connectedto192.168.0.1.
220(vsFTPd1.1.3)
530PleaseloginwithUSERandPASS.
530Pleaselogin

上一页[1][2]