vsftpd.confg 常用配置,Beyond Compare 测试可用

vsftpd.confg 常用配置,备份一下, 经常配置好久 , 以后直接粘贴即可.
Beyond Compare 测试可用.

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# 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.
listen_ipv6=NO
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# 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.
#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 restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=NO
#
# 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=NO
# (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
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/data/www
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO

#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
utf8_filesystem=YES
#服务器所在公网的ip
pasv_address=22.15.545.45
#服务器开放的端口范围
pasv_min_port=30000
pasv_max_port=30100

给文件夹赋予755权限

sudo chmod -R 755 /data/www

在这里插入图片描述
这个配置经过测试在局域网环境下是可以使用的.
如果要跨越路由器 , 那么路由器要开放一些端口 .
vsftpd.confg中设置被动模式的几个端口,

#服务器所在公网的ip
pasv_address=22.15.545.45
#服务器开放的端口范围
pasv_min_port=30000
pasv_max_port=30100

如果提示需要账号密码
那么最好建一个新用户

# 创建ftpa用户,指定此用户的主目录。
# `-d` 选项用于指定用户的主目录;`-s` 选项用于指定用户的默认 shell。
# `/sbin/nologin` 是一个特殊的 shell,它不允许用户登录系统.
# 通常用于限制某些用户只能通过特定的服务(如FTP、SFTP等)进行远程访问,
# 而不能直接登录系统。
#sudo useradd -d /data/www -s /sbin/nologin ftpa
 sudo useradd -d /data/www  ftpa

然后改个密码

passwd ftpa

如果提示

cannot change directory:/home/ftpa

这是因为ftpa用户新建的时候并没有新建 /home/ftpa 目录 那么新建一个这个目录即可, 登录成功后会自动转向到其它目录.

mkdir /home/ftpa

如果提示

530 Login incorrect.
禁止登录了.

是因为 sudo useradd -d /data/www -s /sbin/nologin ftpa 的时候 -s选项禁止登录了.

重新建用户即可

sudo useradd -d /data/www ftpa

如果提示 无法检索文件夹内容,并提示

已发送>PORT 192,168,110,127,255,224
接收>500 Illegal PORT command.

则大概率是端口没开放, 这是主动连接模式. 这样的模式是 :服务端从20端口主动向客户端发起连接,工作过程如下图所示:
第一步中,FTP客户端提交PORT命令并允许服务器来回连它的数据端口(1027端口)。

第二步中,服务器返回确认。

在第三步中,FTP服务器向客户端发送TCP连接请求,目标端口为1027,源端口为20。建立起传输数据的连接。
在这里插入图片描述

4、被动模式:服务端在指定范围内的某各端口被动等待客户,被动发起连接。

在第一步中,客户端的命令端口与服务器的命令端口建立连接,并发送命令"PASV"。

在第二步中,服务器返回命令"PORT 2024"告诉客户端:服务器用哪各端口监听数据连接。

在第三步中 ,客户端初始化一个从自己的数据端口到到服务器指定的数据端口的数据连接。

在第四步中,服务器给客户端的数据端口返回一个"ACK"响应。

在这里插入图片描述

正常情况下, 我们的ftp客户端都是放在内网的, ftp是无法主动访问到我们的客户端的, 除非ftp服务器和客户端在同一个网段下, 或者端口都映射过了才可行. 所以一般是不会使用主动模式的, 基本上都是被动模式. 也即是我们的客户端主动去连接ftp服务器.
Beyond Compare的ftp配置也默认是被动模式

如果提示

2023/12/6 星期三 11:39:26 接收>250 Directory successfully changed.
2023/12/6 星期三 11:39:26 已发送>PASV
2023/12/6 星期三 11:39:26 接收>227 Entering Passive Mode (192,168,1,3,55,93).
2023/12/6 星期三 11:39:26 已发送>LIST

则说明Beyond Compare是在被动模式下运行的. 客户端需要连接ip 192.168.1.3 进行连接. 后面2位,55,93暂时不知道干啥用的

我的云服务器上因为有两个ip, 竟然返回了一个内网ip… 我晕.
那么要告诉vsftpd 被动模式的ip地址是外网ip.

pasv_address=22.15.545.45

那么服务器上的防火墙要保证 172,25,21,182,40,199 这几个端口是可以访问的.

如果卡在了

2023/12/6 星期三 11:39:26 接收>250 Directory successfully changed.
2023/12/6 星期三 11:39:26 已发送>PASV
2023/12/6 星期三 11:39:26 接收>227 Entering Passive Mode (0,0,0,0,55,93).

是因为开启了ipv6的监听, 配置上关闭ipv6的监听, 然后打开listen.不打开listen选项好像不行

listen=YES
listen_ipv6=NO

最后安全建议, ftp用完就关

service vsftpd stop
service vsftpd strat
service vsftpd restrat

则是因为开启了ipv6的原因
我关于ftp的配置觉得下面这篇文章是最好的
https://blog.csdn.net/weixin_52799373/article/details/131045373

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/222422.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

使用有道词典复制网页上的字

1. 今天发现一个新大陆,同事教的,有道词典可以复制网页上的字,也可以复制PDF文件等一些限制不可复制的字,原来不可复制的字,现在用有道都可以复制了,不需要用油猴下载脚本了。写给老婆这种纯电脑小白的。其…

销售人员如何自我提升?

销售人员如何自我提升? 在美国有这么一句流行语:不当总统就干销售员。其实在国内很多老板,高收入人群等大部分是来自销售岗位。因为销售是离钱最近的职业,在销售职业生涯中能收获到很多,比如人际关系能力,…

使用Scanner扫描器和if语句来判断QQ等级的活跃程度

一、主要特点 总体使用try包围起来,用到了Scanner扫描器,还用到了若干if语句。 二、运行代码 import java.util.Scanner; public class QQtest {public static void main(String[] args){try (Scanner scan new Scanner(System.in)) {System.out.pr…

【C语言】mmap函数

mmap是一种在Unix/Linux操作系统中将文件映射到进程的地址空间的方法,它允许程序像访问内存一样访问文件。这种方法可以提高文件访问的速度和效率,特别是对于大文件而言。 以下是mmap的基本使用方法: 1. 包含头文件: 在使用mma…

预览控制;预见控制;预测控制;预观控制(preview control)

预演控制(preview control)作为一种新兴的控制方法,首次在轮式车辆中被提出。 参考文献: https://www.sciencedirect.com/science/article/pii/S0016003219300390https://www.sciencedirect.com/science/article/pii/S0016003219…

消息队列zookeeper集群+kafka

消息队列zookeeper集群kafka kafka 3.0之前依赖于zookpeeper zookeeper开源分布式架构,提供协调服务(Apache项目) 基于观察者模式设计的分布式服务管理架构 存储和管理数据。分布式节点的服务结束观察者的注册,一旦分布式节点…

【WPF 按钮点击后异步上传多文件code示例】

前言: WPF中按钮点击事件如何执行时间太长会导致整个UI线程卡顿,现象就是页面刷新卡住,点击其他按钮无反馈。如下是进行异步执行命令,并远程上传文件的代码。 // 这里对于长时间执行的任务,必须使用异步方法进行处理private async…

HomeAssistant如何添加HACS插件实现公网控制米家与HomeKit等智能家居

HomeAssistant添加HACS插件并实现公网控制米家,HomeKit等智能家居 文章目录 HomeAssistant添加HACS插件并实现公网控制米家,HomeKit等智能家居基本条件一、下载HACS源码二、添加HACS集成三、绑定米家设备 ​ 上文介绍了如何实现群晖Docker部署HomeAssist…

【算法系列篇】递归、搜索与回溯(一)

文章目录 什么是递归、搜索与回溯算法1. 汉诺塔1.1 题目要求1.2 做题思路1.3 代码实现 2. 合并两个有序链表2.1 题目要求2.2 做题思路2.3 代码实现 3. 反转链表3.2 题目要求3.2 做题思路3.3 代码实现 什么是递归、搜索与回溯算法 递归算法是一种通过重复将问题分解为同类的子问…

是宝箱还是潘朵拉魔盒?ChatGPT正在悄然改变世界...

2022年11月30日,OpenAI推出了一款全新的对话式通用人工智能工具——ChatGPT。与以往的人工智障不同,ChatGPT能够与用户进行自然、流畅的对话,帮助人们解答各种问题,提供所需的帮助和支持。 据报道,ChatGPT在推出短短几…

技术阅读周刊第第8️⃣期

技术阅读周刊,每周更新。 历史更新 20231103:第四期20231107:第五期20231117:第六期20231124:第七期 Prometheus vs. VictoriaMetrics (VM) | Last9 URL: https://last9.io/blog/prometheus-vs-victoriametrics/?refd…

中碳CCNG:碳交易领域的革命者

在全球碳减排努力日益增强的背景下,中国碳中和发展集团有限公司(简称中碳CCNG)正以其创新的碳交易平台引领行业新趋势。中碳CCNG提供的一站式综合服务不仅包括碳信用的托管、买卖和抵消,而且通过其综合性数字平台,促进…

Mysql- 流程函数-(If, CASE WHEN)的使用及练习

目录 4.1 If函数语法格式 4.2 CASE WHEN 条件表达式格式 4.3 练习题1 4.4 练习题2 4.5 练习题3-行转列 4.6 牛客练习题 4.7 LeetCode练习题 4.1 If函数语法格式 IF(expr1,expr2,expr3) 解释&#xff1a; 如果表达式expr1true(expr1 <> 0 and expr1 <> NUL…

element-plus组件中的el-drawer的使用

在项目的制作过程中经常会用到弹窗组件&#xff0c;这里假设一种情况当你在一个页面需要多个弹窗组件的时候怎么样才能精准的打开和关闭对应的弹窗呐&#xff1f;&#xff1f; ① 绑定一个点击事件----【给点击事件传入一个下标】这里是打开事件 ② 使用element-plus中的 :befo…

Redis系列之keys命令和scan命令性能对比

项目场景 Redis的keys *命令在生产环境是慎用的&#xff0c;特别是一些并发量很大的项目&#xff0c;原因是Redis是单线程的&#xff0c;keys *会引发Redis锁&#xff0c;占用reids CPU&#xff0c;如果key数量很大而且并发是比较大的情况&#xff0c;效率是很慢的&#xff0c…

ActiveMQ 反序列化漏洞(CVE-2015-5254)

ActiveMQ 反序列化漏洞 Apache ActiveMQ是一种开源的消息代理&#xff08;message broker&#xff09;&#xff0c;被广泛用于应用程序之间的消息传递。它提供可靠的消息传递模式&#xff0c;如发布/订阅、点对点和请求/响应&#xff0c;非常适合构建分布式系统和应用程序集成…

感觉到自己思想扭曲了

突然觉得自己思想有点扭曲。 ​起因是近期备婚&#xff0c;需要给男方家人买衣服。问男朋友妹妹衣服预算多少&#xff0c;说是500内&#xff0c;然后想想自己这个新娘子&#xff0c;那一身衣服绞尽脑汁凑满减不到300。再联想到装饰新房&#xff0c;新房买家具&#xff0c;为了省…

为 3D 模型制作纹理的 9 种最佳方法

在线工具推荐&#xff1a; 3D数字孪生场景编辑器 - GLTF/GLB材质纹理编辑器 - 3D模型在线转换 - Three.js AI自动纹理开发包 - YOLO 虚幻合成数据生成器 - 三维模型预览图生成器 - 3D模型语义搜索引擎 与普遍的看法相反&#xff0c;3D 模型的纹理创建更加简单。虽然对细节…

【PyQt学习篇 · ⑫】:QVBoxLayout和QHBoxLayout布局管理器的使用

文章目录 QVBoxLayout和QHBoxLayout的介绍.addStretch()的使用方法.setSpacing()方法的使用.setAlignment()的使用.setFixedSize()的使用QMainWindow中使用布局管理器 QVBoxLayout和QHBoxLayout的介绍 QVBoxLayout 和 QHBoxLayout 是 PyQt 中用于实现垂直和水平布局的两个布局…

CoreDNS实战(五)-接入prometheus监控

1 背景 Prometheus插件作为coredns的Plugins&#xff0c;默认情况下是内置在coredns中&#xff0c;如果是自己编译安装的版本&#xff0c;需要注意在编译安装的时候的plugin.cfg文件中添加了prometheus:metrics&#xff0c;这样才能确保编译成功。 # 首先我们检查一下运行的版…