当前位置:网站首页>FTP文件传输协议
FTP文件传输协议
2022-07-28 14:39:00 【不会调制解调的猫】
传输模式
FTP支持两种模式:Standard (PORT方式,主动方式),Passive (PASV,被动方式)。
Port模式
FTP 客户端首先和服务器的TCP 21端口建立连接,用来发送命令,客户端需要接收数据的时候在这个通道上发送PORT命令。PORT命令包含了客户端用什么端口接收数据。在传送数据的时候,服务器端通过自己的TCP 20端口连接至客户端的指定端口发送数据。FTP server必须和客户端建立一个新的连接用来传送数据。
Passive模式
建立控制通道和Standard模式类似,但建立连接后发送Pasv命令。服务器收到Pasv命令后,打开一个临时端口(端口号大于1023小于65535)并且通知客户端在这个端口上传送数据的请求,客户端连接FTP服务器此端口,然后FTP服务器将通过这个端口传送数据。
很多 防火墙在设置的时候都是不允许接受外部发起的连接的,所以许多位于防火墙后或内网的FTP服务器不支持PASV模式,因为客户端无法穿过防火墙打开FTP服务器的高端端口;而许多内网的客户端不能用PORT模式登陆FTP服务器,因为从服务器的TCP 20无法和内部网络的客户端建立一个新的连接,造成无法工作。
配置
安装
yum install -y vsftpd
关闭防火墙
systemctl stop firewalld
setenforce 0设置服务启动
systemctl enable vsftpd
#开机自启动
systemctl start vsftpd
#开启vsftpd
systemctl status vsftpd
#查看vsftpd的状态
修改配置文件(匿名访问)
vim /etc/vsftpd/vsftpd.conf

测试
在/var/ftp/pub/下创建一个txt文本文件,在windows的此电脑中,输入ftp服务器的地址

成功!
账户密码登录FTP
进入/etc/vsftpd/vsftpd.conf对配置文件进行设置
vim /etc/vsftpd/vsftpd.conf



进入/etc/vsftpd/chroot_list增加被限制登录的用户名
vim /etc/vsftpd/chroot_list
paul #登录用户名配置文件黑名单 白名单
/etc/vsftpd/user_list默认为黑名单,去掉if userlist_dent=NO的注释,开启白名单,只有以下用户可以进行登录,我们加入用户quota到黑名单中。
echo quota >> /etc/vsftpd/user_list# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
quotaquota用户被禁止登录
在/etc/vsftpd/vsftpd.conf中配置,重启服务后quota登录成功
vim /etc/vsftpd/vsftpd.conf
userlist_enable=YES
userlist_deny=NO边栏推荐
- Stateflow逻辑系统建模
- 1200 times faster! MIT develops a new generation of drug research and development AI, and suspends the old model
- VS使用技巧
- Late 2021 year-end summary
- 3、基本常数和宏定义
- 已拿下华为85亿元屏幕订单?维信诺回应:客户要求保密,无法回复!
- 21、电文处理任务定义
- 一文了解 Rainbond 云原生应用管理平台
- Daily news on July 28, 2022: Science: AI has made another breakthrough in protein design, and can design specific functional proteins
- 软件架构与设计(六)-----层次结构体
猜你喜欢
随机推荐
Stateflow逻辑系统建模
如何通过adb打开和关闭飞行模式
在OBS上进行H265推流
Matlab exports high-definition pictures without distortion in word compression and PDF conversion
Among the three "difficult and miscellaneous diseases" of machine learning, causal learning is the breakthrough | Liu Li, Chongqing University
软件架构与设计(六)-----层次结构体
生命的感悟
全国985院校考研信息汇总整理
19. Channel assignment task definition
详解.NET的求复杂类型集合的差集、交集、并集
Summary and arrangement of postgraduate entrance examination information of 211 colleges and universities nationwide
全国211院校考研信息汇总整理
leetcode-括号有效性问题
语音社交系统——完善有声系统产业链
9、相关数据累积任务定义
Ffmpeg notes
Opencv - closely combine multiple irregular small graphs into large graphs
Gfpgan blurred photo repair artifact
Explain the difference set, intersection set and union set of complex type set in detail.Net
NFTScan 与 NFTPlay 在 NFT 数据领域达成战略合作








