linux中ftp的配置.docx

上传人:b****1 文档编号:10939869 上传时间:2023-05-28 格式:DOCX 页数:21 大小:524.46KB
下载 相关 举报
linux中ftp的配置.docx_第1页
第1页 / 共21页
linux中ftp的配置.docx_第2页
第2页 / 共21页
linux中ftp的配置.docx_第3页
第3页 / 共21页
linux中ftp的配置.docx_第4页
第4页 / 共21页
linux中ftp的配置.docx_第5页
第5页 / 共21页
linux中ftp的配置.docx_第6页
第6页 / 共21页
linux中ftp的配置.docx_第7页
第7页 / 共21页
linux中ftp的配置.docx_第8页
第8页 / 共21页
linux中ftp的配置.docx_第9页
第9页 / 共21页
linux中ftp的配置.docx_第10页
第10页 / 共21页
linux中ftp的配置.docx_第11页
第11页 / 共21页
linux中ftp的配置.docx_第12页
第12页 / 共21页
linux中ftp的配置.docx_第13页
第13页 / 共21页
linux中ftp的配置.docx_第14页
第14页 / 共21页
linux中ftp的配置.docx_第15页
第15页 / 共21页
linux中ftp的配置.docx_第16页
第16页 / 共21页
linux中ftp的配置.docx_第17页
第17页 / 共21页
linux中ftp的配置.docx_第18页
第18页 / 共21页
linux中ftp的配置.docx_第19页
第19页 / 共21页
linux中ftp的配置.docx_第20页
第20页 / 共21页
亲,该文档总共21页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

linux中ftp的配置.docx

《linux中ftp的配置.docx》由会员分享,可在线阅读,更多相关《linux中ftp的配置.docx(21页珍藏版)》请在冰点文库上搜索。

linux中ftp的配置.docx

linux中ftp的配置

简单介绍一下linux下的ftp服务及相关配置

实验目的搭建一个可以实现上传下载的简易的ftp服务器,

实验环境vmware6.5.2+redhatEnterpriselinux5AS

简单了解一下ftp服务器

简单的说,我们说支持ftp协议的服务器就是ftp服务器

他的主要功能就是实现文件的上传和下载,通常下载要多一点,在同一个Internet下的不同操作系统之间实现文件的交流

windows下利用IIS可以简单的实现ftp服务,利用Serv-U等第三方工具,也是可以很好的实现ftp服务的

首先我们要明确一点,这个是连接到互联网的,提供一些资料供大家下载的,当然也可以上传,那么他的安全性就显得尤为重要,这也是为什么介绍linux下的ftp服务的原因

常用的服务器端软件,早期的wuftp,传说中非常安全的vsftp,以及专业版的proftp

今天的客户端windowsserver2003上安装的flashfxp

ftp使用的端口

这么说感觉有点乱,

边做边讲吧,,本文不涉及深刻的原理性的东西

我的内核版本

[root@localhost~]#cd/mnt

[root@localhostmnt]#ls

cdromhgfs

[root@localhostmnt]#mount/dev/cdrom/mnt/cdrom

mount:

blockdevice/dev/cdromiswrite-protected,mountingread-only

[root@localhostmnt]#pwd

/mnt

[root@localhostmnt]#cdcdrom/Server

[root@localhostServer]#

[root@localhostServer]#rpm-ivhvsftpd-2.0.5-10.el5.i386.rpm

warning:

vsftpd-2.0.5-10.el5.i386.rpm:

HeaderV3DSAsignature:

NOKEY,keyID37017186

Preparing...###########################################[100%]

1:

vsftpd###########################################[100%]

[root@localhostServer]#

安装ftp服务我们只需要一个包rpm-ivhvsftpd-2.0.5-10.el5.i386.rpm

他的登陆用户

普通用户(系统用户)

匿名用户(anonymous)

普通用户大都是在系统内建立的账户,或者属于哪个组,访问需要密码

匿名用户用户名通常是anonymous密码通常为空,也就是说可以允许很多人访问,

他的相关文件

/etc/vsftpd/vsftpd.conf配置文件

/etc/vsftpd/ftpusers用户访问控制文件

/etc/vsftpd/user_list

任何情况下写进/etc/vsftpd/ftpusers里的用户都将被禁止访问

修改了/etc/vsftpd/vsftpd.conf配置文件的关键字后,只有写入/etc/vsftpd/user_list

的用户名,才可以访问

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

#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.

local_enable=YES

启用本地用户

#

#UncommentthistoenableanyformofFTPwritecommand.

write_enable=YES

#

#Defaultumaskforlocalusersis077.Youmaywishtochangethisto022,

#ifyourusersexpectthat(022isusedbymostotherftpd's)

local_umask=022

这里是说目录默认权限,

文件的默认权限是666的话那么666-022=644

目录的默认权限是777的话那么777-022=755

这里你把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

连接端口20

#

#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

使用标准的xferlog模式

#

#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

是否允许运行特殊的ftp命令async

#

#BydefaulttheserverwillpretendtoallowASCIImodebutinfactignore

#therequest.TurnonthebelowoptionstohavetheserveractuallydoASCII

#manglingonfileswheninASCIImode.

#BewarethatonsomeFTPservers,ASCIIsupportallowsadenialofservice

#attack(DoS)viathecommand"SIZE/big/file"inASCIImode.vsftpd

#predictedthisattackandhasalwaysbeensafe,reportingthesizeofthe

#rawfile.

#ASCIImanglingisahorriblefeatureoftheprotocol.

#ascii_upload_enable=YES

#ascii_download_enable=YES

使用ASCII的上传和下载

#

#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

若是启动此功能,则允许登入者使用ls-R这个指令。

默认值为NO

#

#When"listen"directiveisenabled,vsftpdrunsinstandalonemodeand

#listensonIPv4sockets.Thisdirectivecannotbeusedinconjunction

#withthelisten_ipv6directive.

listen=YES

#

#ThisdirectiveenableslisteningonIPv6sockets.TolistenonIPv4andIPv6

#sockets,youmustruntwocopiesofvsftpdwhithtwoconfigurationfiles.

#Makesure,thatoneofthelistenoptionsiscommented!

!

#listen_ipv6=YES

pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES

——————————————————————————————————————————————————————————————————————————————

我们暂时先不做任何修改

确保我们的DNS解析正常

重启服务

[root@localhostServer]#servicevsftpdrestart

关闭vsftpd:

[失败]

为vsftpd启动vsftpd:

[确定]

[root@localhostServer]#

服务器的ip是192.168.0.5客户端用windowsserver2003

我用aa用户密码为空登陆ftp服务器ls后显示有一个pub目录

上面装了flashfxp客户端我们打开FlashFxp

我们双击上层目录,就会发现,它是可以打开得,也是可以下载的,

用记事本打开

虽然这不能看到密码,但这也是很不安全的,想想看我们的ftp服务器是要放到公网上去的,所以我们自身的安全就显得尤为重要,

如果用户用匿名登陆不用填写用户名直接勾选复选款即可

还有就是

注意这里的用户名是anonymous密码是空

[root@localhost~]#vi/etc/vsftpd/vsftpd.conf

我们来修改一下配置文件解决这个问题

chroot_local_user=YES

添加这么一句

注意大小写

保存退出

重启服务

[root@localhost~]#servicevsftpdrestart

关闭vsftpd:

[确定]

为vsftpd启动vsftpd:

[确定]

[root@localhost~]#

这时不论你是用的匿名用户还是普通用户,都不能对上层目录进行访问,添加的这一句就是把用户限定在,只能访问自己家目录下的文件,

第二个应用限定特定用户访问,

记得这两个用户控制文件

/etc/vsftpd/ftpusers

把aa用户加入到这个文件之后,会发现aa就访问不了了

/etc/vsftpd/user_list

还有一种方法是

修改配置文件

[root@localhost~]#vi/etc/vsftpd/vsftpd.conf

userlist_enable=YES

userlist_deny=NO

userlist_file=/etc/vsftpd/user_list

这三句话的意思是,只有写入/etc/vsftpd/user_list的文件中的用户才可以访问其他用户不允许访问

修改完配置文件后重启服务

[root@localhost~]#vi/etc/vsftpd/user_list

在这个文件里添加用户

比如说添加了aabbanonymous

三个用户

这时bb成功登陆

匿名用户成功登陆

aa用户是登陆不上去的

我们说不论在什么情况下,只要把用户名写入/etc/vsftpd/ftpusers文件的用户就永远登不上去

第三个应用匿名用户的访问控制

对于匿名用户我们主要是控制他上传,修改,因为你不能确定他上传的东西是不是病毒等等

在修改配置文件之前匿名用户拥有的权限很小,不能建立目录,不能改名,不能上传等等

修改配置文件加入以下几行位置随便你

[root@localhost~]#vi/etc/vsftpd/vsftpd.conf

anon_upload_enable=YES

anon_mkdir_write_enable=YES

anon_other_write_enable=YES

[root@localhost~]#servicevsftpdrestart

关闭vsftpd:

[确定]

为vsftpd启动vsftpd:

[确定]

[root@localhost~]#

重启服务

这时你要是用匿名用户访问的话还是建立不了目录的

因为默认的根目录是不能上传的

[root@localhost~]#cd/var/ftp

[root@localhostftp]#ls

pub

[root@localhostftp]#cdpub

[root@localhostpub]#ls

[root@localhostpub]#mkdirtest

[root@localhostpub]#ll

总计8

drwxr-xr-x2rootroot409605-0215:

24test

[root@localhostpub]#chownftptest

[root@localhostpub]#

我们在匿名用户的默认家目录/var/ftp/pub下建立子目录、并修改test的属组

这时你在test下就可以建立目录删除改名上传等等了

[root@localhostpub]#cdtest

[root@localhosttest]#ls

aaad

[root@localhosttest]#cdaa

[root@localhostaa]#ls

passwd

[root@localhostaa]#

服务器上看一下

实例应用限制匿名用户的访问数量

修改配置文件

添加如下键值

anon_max_rate=300

限制用户上限为300数字根据实际情况定义

现就简单的介绍到这里,ftp的服务和功能远远不止这些,相对于samba来说,ftp主要是应用于公网。

文中不到或是错误之处,还望看到的朋友多多指教

本文出自“老五的成长记录”博客

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2