1ftp服务定义:FTPFileTransfer Protocol(文件传输协议)的英文简称,而中文简称“文传协议”。用于Internet上的控制文件的双向传输。

由于一下实验是在虚拟机中进行的,为了避免一些不必要的现象出现,先将虚拟机reset还原一次,然后开启之后在yum 中改了url的指向,并且vim /etc/sysconfig/selinux 目录下的config文件中的第一行改为disabled ,然后重启就可以做了。

yum install vsftpd -y

linux下的ftp服务器搭建_ftp

开启vsftpd服务并将它加载到火墙中。开机启动

linux下的ftp服务器搭建_协议_02

在浏览器测试:ftp://172.25.254.220

linux下的ftp服务器搭建_ftp_03

ftp服务的基本信息

1)软件安装包:vsfgtpd

2)默认发布目录:/var/ftp

3)协议接口:主动21被动>1024 ss antlpe |grep vsftpd 查看端口

4)服务配置文件:/etc/vsftpd/vsftpd.conf,通过修改相对应的参数,实现相关功能,配置完systemctl restart vsftpd重启服务,即可。

(5)基本报错解析:

    

  500文件系统权限过大

  530用户认证失败

  550服务本身未开放

  553本地文件系统权限过小

 

linux下的ftp服务器搭建_协议_04

aninymous enable=YES|NO --匿名用户是否可以登陆

write_enable=YES|NO ---是否对登陆用户可写

anon_upload_enable=YES ---允许匿名用户上传

在改完/etc/vsftpd/vsftpd.conf后执行下边两条命令

chgrpftp   /var/ftp/pub

chmod   775    /var/ftp/pub

linux下的ftp服务器搭建_协议_05

不允许匿名用户登陆

linux下的ftp服务器搭建_ftp_06

linux下的ftp服务器搭建_ftp_07

本地用户不许登陆

local_enbled=NO

linux下的ftp服务器搭建_协议_08

linux下的ftp服务器搭建_协议_09


linux下的ftp服务器搭建_ftp_10

本地用户可以登陆

linux下的ftp服务器搭建_协议_11

linux下的ftp服务器搭建_协议_12

anon_root=/LBJ                             ###匿名用户的家目录在/LBJ下

anon_upload_enable=YES             ###   匿名用户可以上传

anon_umask=022                          ###  修改上传权限为644

anon_mkdir_write_enable=YES     ###    匿名用户可以建立目录

anon_world_readable_only=NO    ###    匿名用户可以下载

anon_other_write_enable=YES       ###   匿名用户删除,只能删除自己上传的文件

linux下的ftp服务器搭建_ftp_13

chown_uploads=YES                               ---匿名用户使用的身份修改

chown_username=student

anon_max_rate=102400                            ---最大上传速率限制1M

linux下的ftp服务器搭建_协议_14

linux下的ftp服务器搭建_ftp_15

linux下的ftp服务器搭建_ftp_16

max_clients=2                                            ---最大连接数目

local_root=/../..                                           ---修改本地用户家目录

chroot_local_user=YES                               ---所有用户被锁定到自己家目录

linux下的ftp服务器搭建_ftp_17

linux下的ftp服务器搭建_协议_18

用户黑名单建立

chroot_local_user=NO

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list

linux下的ftp服务器搭建_ftp_19

linux下的ftp服务器搭建_ftp_20

用户白名单建立

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list

linux下的ftp服务器搭建_协议_21

限制本地用户登陆(默认情况下ftpusersuser_list都是黑名单)

vim/etc/vsftpd/ftpusers                               ---用户黑名单

vim/etc/vsftpd/user_list                               ---用户临时黑名单

linux下的ftp服务器搭建_ftp_22

linux下的ftp服务器搭建_协议_23

linux下的ftp服务器搭建_协议_24
用户白名单的设定

usetlist deny=NO    将此参数修改为NO ,则黑名单自动变为白名单。