IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 系统运维 -> CentOS7安装ftp服务并使用windows访问 -> 正文阅读

[系统运维]CentOS7安装ftp服务并使用windows访问

一、背景信息

FTP(File Transfer Protocol)是一种文件传输协议,基于客户端/服务器架构,支持以下两种工作模式:

  1. port方式(主动模式), 连接过程:客户端向服务器的FTP端口(默认是21)发送连接请求,服务器接受连接,建立一条命令链路。当需要传送数据时, 客户端在命令链路上用PORT命令告诉服务器:我打开了***X端口,你过来连接我。于是服务器从20端口向客户端的***X端口发送连接请求,建立一条数据链路来传送数据
    在这里插入图片描述
  2. pasv方式 ( 被动模式 ), 连接过程:客户端向服务器的FTP端口(默认是21)发送连接请求,服务器接受连接,建立一条命令链路。当需要传送数据时, 服务器在命令链路上用PASV命令告诉客户端:我打开了X端口,你过来连接我。于是客户端向服务器的X端口发送连接请求,建立一条数据路来传送数据。
    在这里插入图片描述

FTP支持以下三种认证模式:

  1. 匿名用户模式:任何人无需密码验证就可以直接登录到FTP服务器。这种模式最不安全,一般只用来保存不重要的公开文件,不推荐在生产环境中使用。
  2. 本地用户模式:通过Linux系统本地账号进行验证的模式,相较于匿名用户模式更安全。
  3. 虚拟用户模式:FTP服务器的专有用户。虚拟用户只能访问Linux系统为其提供的FTP服务,而不能访问Linux系统的其它资源,进一步增强了FTP服务器的安全性。

本文主要介绍被动模式下,使用本地用户访问FTP服务器的配置方法。关于匿名模式的配置方式、第三方FTP客户端工具使用方式等介绍,请参见常见问题。

本文示例步骤使用以下资源版本:操作系统:CentOS 7.2 64位
当您使用不同软件版本时,可能需要根据实际情况调整命令和参数配置。

二、安装并配置vsftpd

  1. 步骤一:安装vsftpd:运行以下命令安装vsftpd。
yum install -y vsftpd
  1. 使用本地root作为远程链接ftp账户的话,需要以下配置

打开ftpusers和user_list, 在root和nobody前面加上#.在实际情况不提倡这样,否则太危险了.

在这里插入图片描述

  1. 配置文件 vsftpd.conf
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode. The vsftpd.conf(5) man page explains
# the behaviour when these options are disabled.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
# FTP在传输数据时,可使用二进制(Binary)方式,也可使用ASCII模式来上传或下载数据。
ascii_upload_enable=YES
ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
# 关闭监听IPV6 sockets
listen_ipv6=YES
# #使用pam验证
pam_service_name=vsftpd
# #启用userlist功能
userlist_enable=YES
# #启用拒绝特定用户登录
userlist_deny=YES
userlist_file=/etc/vsftpd/user_list
# #ftp standalone模式下需开启
tcp_wrappers=YES

#开启被动模式。
pasv_enable=YES
allow_writeable_chroot=YES
###本教程中为Linux实例的公网IP。
#pasv_address=192.168.31.8
#设置被动模式下,建立数据传输可使用的端口范围的最小值。
###建议您把端口范围设置在一段比较高的范围内,例如50000~50010,有助于提高访问FTP服务器的安全性。
pasv_min_port=50000
###设置被动模式下,建立数据传输可使用的端口范围的最大值。
pasv_max_port=50010
#用户登录后所在的目录
local_root=/

更详细的配置

  1. linux启动ftp服务
# 1.放开22端口 和被动模式所需端口
firewall-cmd --zone=public --add-port=21/tcp --permanent     
firewall-cmd --zone=public --add-port=50000-50010/tcp --permanent
firewall-cmd --reload
#2.启动服务
service vsftpd start
#3.设置自启动
chkconfig vsftpd on

三、windows启用FTP

参考文章
到此可以成功使用
在这里插入图片描述

如果有遇到,failed to change directory 该错误,参考以下:
在这里插入图片描述
参考文章
参考文章
参考文章

  系统运维 最新文章
配置小型公司网络WLAN基本业务(AC通过三层
如何在交付运维过程中建立风险底线意识,提
快速传输大文件,怎么通过网络传大文件给对
从游戏服务端角度分析移动同步(状态同步)
MySQL使用MyCat实现分库分表
如何用DWDM射频光纤技术实现200公里外的站点
国内顺畅下载k8s.gcr.io的镜像
自动化测试appium
ctfshow ssrf
Linux操作系统学习之实用指令(Centos7/8均
上一篇文章      下一篇文章      查看所有文章
加:2022-06-16 21:53:05  更:2022-06-16 21:54:55 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/19 1:05:52-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码