debian11 ubuntu24 armbian24 apt install pure-ftpd被动模式的正确配置方法

安装方法请看:https://www.itbulu.com/pure-ftpd.html

疑难问题解决

原本以为配置很简单的,无非是修改 ForcePassiveIP MinUID PassivePortRange PureDB这几个配置项就行了,然而问题并不那个简单。

我们先看看原本的配置文件,应该是 /etc/pure-ftpd/pure-ftpd.conf吧,我们来看看里面有啥配置参数。


############################################################
#                                                          #
#             Configuration file for pure-ftpd             #
#                                                          #
############################################################# If you want to run Pure-FTPd with this configuration
# instead of command-line options, please run the
# following command :
#
# ${exec_prefix}/sbin/sbin/pure-ftpd /etc/pure-ftpd/pure-ftpd.conf
#
# Online documentation:
# https://www.pureftpd.org/project/pure-ftpd/doc# Restrict users to their home directoryChrootEveryone               yes# If the previous option is set to "no", members of the following group
# won't be restricted. Others will be. If you don't want chroot()ing anyone,
# just comment out ChrootEveryone and TrustedGID.# TrustedGID                   100# Turn on compatibility hacks for broken clientsBrokenClientsCompatibility   no# Maximum number of simultaneous usersMaxClientsNumber             50# Run as a background processDaemonize                    yes# Maximum number of simultaneous clients with the same IP addressMaxClientsPerIP              8# If you want to log all client commands, set this to "yes".
# This directive can be specified twice to also log server responses.VerboseLog                   no# List dot-files even when the client doesn't send "-a".DisplayDotFiles              yes# Disallow authenticated users - Act only as a public FTP server.AnonymousOnly                no# Disallow anonymous connections. Only accept authenticated users.NoAnonymous                  no# Syslog facility (auth, authpriv, daemon, ftp, security, user, local*)
# The default facility is "ftp". "none" disables logging.SyslogFacility               ftp# Display fortune cookies# FortunesFile                 /usr/share/fortune/zippy# Don't resolve host names in log files. Recommended unless you trust
# reverse host names, and don't care about DNS resolution being possibly slow.DontResolve                  yes# Maximum idle time in minutes (default = 15 minutes)MaxIdleTime                  15# LDAP configuration file (see README.LDAP)# LDAPConfigFile               /etc/pureftpd-ldap.conf# MySQL configuration file (see README.MySQL)# MySQLConfigFile              /etc/pureftpd-mysql.conf# PostgreSQL configuration file (see README.PGSQL)# PGSQLConfigFile              /etc/pureftpd-pgsql.conf# PureDB user database (see README.Virtual-Users)# PureDB                       /etc/pureftpd.pdb# Path to pure-authd socket (see README.Authentication-Modules)# ExtAuth                      /var/run/ftpd.sock# If you want to enable PAM authentication, uncomment the following line# PAMAuthentication            yes# If you want simple Unix (/etc/passwd) authentication, uncomment this# UnixAuthentication           yes# Please note that LDAPConfigFile, MySQLConfigFile, PAMAuthentication and
# UnixAuthentication can be used specified once, but can be combined
# together. For instance, if you use MySQLConfigFile, then UnixAuthentication,
# the SQL server will be used first. If the SQL authentication fails because the
# user wasn't found, a new attempt will be done using system authentication.
# If the SQL authentication fails because the password didn't match, the
# authentication chain stops here. Authentication methods are chained in
# the order they are given.# 'ls' recursion limits. The first argument is the maximum number of
# files to be displayed. The second one is the max subdirectories depth.LimitRecursion               10000 8# Are anonymous users allowed to create new directories?AnonymousCanCreateDirs       no# If the system load is greater than the given value, anonymous users
# aren't allowed to download.MaxLoad                      4# Port range for passive connections - keep it as broad as possible.#PassivePortRange             50000 55000# Force an IP address in PASV/EPSV replies. - for NAT.
# Symbolic host names are also accepted for gateways with dynamic IP
# addresses.#ForcePassiveIP                192.168.0.1# Upload/download ratio for anonymous users.# AnonymousRatio               1 10# Upload/download ratio for all users.
# This directive supersedes the previous one.# UserRatio                    1 10# Disallow downloads of files owned by the "ftp" system user;
# files that were uploaded but not validated by a local admin.AntiWarez                    yes# IP address/port to listen to (default=all IP addresses, port 21).# Bind                         127.0.0.1,21# Maximum bandwidth for anonymous users in KB/s# AnonymousBandwidth           8# Maximum bandwidth for *all* users (including anonymous) in KB/s
# Use AnonymousBandwidth *or* UserBandwidth, not both.# UserBandwidth                8# File creation mask. <umask for files>:<umask for dirs> .
# 177:077 if you feel paranoid.Umask                        133:022# Minimum UID for an authenticated user to log in.
# For example, a value of 100 prevents all users whose user id is below
# 100 from logging in. If you want "root" to be able to log in, use 0.MinUID                       100# Allow FXP transfers for authenticated users.AllowUserFXP                 no# Allow anonymous FXP for anonymous and non-anonymous users.AllowAnonymousFXP            no# Users can't delete/write files starting with a dot ('.')
# even if they own them. But if TrustedGID is enabled, that group
# will exceptionally have access to dot-files.ProhibitDotFilesWrite        no# Prohibit *reading* of files starting with a dot (.history, .ssh...)ProhibitDotFilesRead         no# Don't overwrite files. When a file whose name already exist is uploaded,
# it gets automatically renamed to file.1, file.2, file.3, ...AutoRename                   no# Prevent anonymous users from uploading new files (no = upload is allowed)AnonymousCantUpload          no# Only connections to this specific IP address are allowed to be
# non-anonymous. You can use this directive to open several public IPs for
# anonymous FTP, and keep a private firewalled IP for remote administration.
# You can also only allow a non-routable local IP (such as 10.x.x.x) for
# authenticated users, and run a public anon-only FTP server on another IP.# TrustedIP                    10.1.1.1# To add the PID to log entries, uncomment the following line.# LogPID                       yes# Create an additional log file with transfers logged in a Apache-like format :
# fw.c9x.org - jedi [13/Apr/2017:19:36:39] "GET /ftp/linux.tar.bz2" 200 21809338
# This log file can then be processed by common HTTP traffic analyzers.# AltLog                       clf:/var/log/pureftpd.log# Create an additional log file with transfers logged in a format optimized
# for statistic reports.# AltLog                       stats:/var/log/pureftpd.log# Create an additional log file with transfers logged in the standard W3C
# format (compatible with many HTTP log analyzers)# AltLog                       w3c:/var/log/pureftpd.log# Disallow the CHMOD command. Users cannot change perms of their own files.# NoChmod                      yes# Allow users to resume/upload files, but *NOT* to delete them.# KeepAllFiles                 yes# Automatically create home directories if they are missing# CreateHomeDir                yes# Enable virtual quotas. The first value is the max number of files.
# The second value is the maximum size, in megabytes.
# So 1000:10 limits every user to 1000 files and 10 MB.# Quota                        1000:10# If your pure-ftpd has been compiled with standalone support, you can change
# the location of the pid file. The default is /var/run/pure-ftpd.pid# PIDFile                      /var/run/pure-ftpd.pid# If your pure-ftpd has been compiled with pure-uploadscript support,
# this will make pure-ftpd write info about new uploads to
# /var/run/pure-ftpd.upload.pipe so pure-uploadscript can read it and
# spawn a script to handle the upload.
# Don't enable this option if you don't actually use pure-uploadscript.# CallUploadScript             yes# This option is useful on servers where anonymous upload is
# allowed. When the partition is more that percententage full,
# new uploads are disallowed.MaxDiskUsage                   99# Set to 'yes' to prevent users from renaming files.# NoRename                     yes# Be 'customer proof': forbids common customer mistakes such as
# 'chmod 0 public_html', that are valid, but can cause customers to
# unintentionally shoot themselves in the foot.CustomerProof                yes# Per-user concurrency limits. Will only work if the FTP server has
# been compiled with --with-peruserlimits.
# Format is: <max sessions per user>:<max anonymous sessions>
# For example, 3:20 means that an authenticated user can have up to 3 active
# sessions, and that up to 20 anonymous sessions are allowed.# PerUserLimits                3:20# When a file is uploaded and there was already a previous version of the file
# with the same name, the old file will neither get removed nor truncated.
# The file will be stored under a temporary name and once the upload is
# complete, it will be atomically renamed. For example, when a large PHP
# script is being uploaded, the web server will keep serving the old version and
# later switch to the new one as soon as the full file will have been
# transferred. This option is incompatible with virtual quotas.# NoTruncate                   yes# This option accepts three values:
# 0: disable SSL/TLS encryption layer (default).
# 1: accept both cleartext and encrypted sessions.
# 2: refuse connections that don't use the TLS security mechanism,
#    including anonymous sessions.
# Do _not_ uncomment this blindly. Double check that:
# 1) The server has been compiled with TLS support (--with-tls),
# 2) A valid certificate is in place,
# 3) Only compatible clients will log in.# TLS                          1# Cipher suite for TLS sessions.
# The default suite is secure and setting this property is usually
# only required to *lower* the security to cope with legacy clients.
# Prefix with -C: in order to require valid client certificates.
# If -C: is used, make sure that clients' public keys are present on
# the server.# TLSCipherSuite               HIGH# Certificate file, for TLS
# The certificate itself and the keys can be bundled into the same
# file or split into two files.
# CertFile is for a cert+key bundle, CertFileAndKey for separate files.
# Use only one of these.# CertFile                     /etc/ssl/private/pure-ftpd.pem
# CertFileAndKey               "/etc/pure-ftpd.pem" "/etc/pure-ftpd.key"# Unix socket of the external certificate handler, for TLS# ExtCert                      /var/run/ftpd-certs.sock# Listen only to IPv4 addresses in standalone mode (ie. disable IPv6)
# By default, both IPv4 and IPv6 are enabled.# IPV4Only                     yes# Listen only to IPv6 addresses in standalone mode (i.e. disable IPv4)
# By default, both IPv4 and IPv6 are enabled.# IPV6Only                     yes# Append the content of another file, if the file exists.
# If the file doesn't exist, the directive is ignored.
# More files can be recursively included.# Include                      additional_configuration.conf

用被动模式

用systemctl start pure-ftpd

在windows上用winscp连接

报错开始:

监测到超时! (数据连接)
无法获得目录列表
列出'/'的目录项时出错。

这是因为被动端口被防火墙阻止了,配置文件修改以下项PassivePortRange:

# Port range for passive connections - keep it as broad as possible.PassivePortRange             50000 55000

再打开防火墙新入站TCP 端口50000/55000,允许这个端口范围可入。

紧接着,下列表错误一直存在,无法解决

Server sent passive reply with unroutable address 172.16.0.33, using host address instead.
监测到超时! (数据连接)
无法获得目录列表
列出'/'的目录项时出错。

把配置文件中的ForcePassiveIP改成公网的地址58.179.xxx.xxx

# Force an IP address in PASV/EPSV replies. - for NAT.
# Symbolic host names are also accepted for gateways with dynamic IP
# addresses.
ForcePassiveIP                58.179.XXX.XXX

问题依然存在

经过无数次试验,终于发现,/etc/pure-ftpd/pure-ftpd.conf这个配置文件根本没有生效,新的配置项被移动到了 /etc/pure-ftpd/conf/文件夹下。

于是用

echo "50000 55000" > /etc/pure-ftpd/conf/PassivePortRange
echo "58.179.XXX.XXX" > /etc/pure-ftpd/conf/ForcePassiveIP
systemctl restart pure-ftpd 

新建相关配置项文件后,重启,再用winscp连接,终于正常了。

关于ddns,动态公网IP配置

再看看配置说明

# Force an IP address in PASV/EPSV replies. - for NAT.
# Symbolic host names are also accepted for gateways with dynamic IP
# addresses.
ForcePassiveIP                58.179.XXX.XXX

也可以用域名。

echo "www.xxxxx.com" > /etc/pure-ftpd/conf/ForcePassiveIP
systemctl restart pure-ftpd 

如果wan口的地址是动态的,ForcePassiveIP可用动态域名,然后再端口转发21->21及50000/55000到pure-ftpd主机即可。

为什么不用主动模式

区别我就不说了,主动模式在大批量删除或传输数据时会不时中断,亲测被动模式没有这个问题。

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

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

量化金融|基于算法和模型的预测研究综述

一、研究背景与发展历程​​1.​​量化投资理论演进​​•奠基阶段&#xff08;1950s-1960s&#xff09;​​&#xff1a;Markowitz均值方差理论&#xff08;1952&#xff09;、CAPM模型&#xff08;1964&#xff09;奠定现代量化投资基础•衍生品定价&#xff08;1970s-1980s&…

从零开始的云计算生活——第六十天,志在千里,使用Jenkins部署K8S

一.安装kubectl1、配置yum源cat <<EOF | tee /etc/yum.repos.d/kubernetes.repo [kubernetes] nameKubernetes baseurlhttps://mirrors.aliyun.com/kubernetes-new/core/stable/v1.28/rpm/ enabled1 gpgcheck1 gpgkeyhttps://mirrors.aliyun.com/kubernetes-new/core/sta…

无人机电压模块技术剖析

无人机电源模块的基本运行方式无人机电压模块的核心任务是对动力电源&#xff08;通常是锂电池&#xff09;进行转换、调节和分配&#xff0c;为飞控、图传、摄像头、舵机等各个子系统提供稳定可靠的电能。其运行方式可以概括为&#xff1a;电压转换与调控&#xff1a;无人机动…

MATLAB基于GM(灰色模型)与LSTM(长短期记忆网络)的组合预测方法

一、GM与LSTM的基本原理及互补性 1. GM模型的核心特点基本原理&#xff1a;通过累加生成&#xff08;AGO&#xff09;将原始无序序列转化为具有指数规律的光滑序列&#xff0c;建立一阶微分方程&#xff08;如GM(1,1)&#xff09;进行预测。其数学形式为&#xff1a; dx(1)dtax…

【菜狗每日记录】启发式算法、傅里叶变换、AC-DTC、Xmeans—20250909

&#x1f431;1、启发式算法 ① 定义 ② 特点 ③ 案例 &#x1f431;2、快速傅里叶变换FFT ① DFT离散傅里叶变换 ② FFT快速傅里叶变换 &#x1f431;3、AC-DTC聚类 &#x1f431;4、Xmeans &#x1f431;1、启发式算法 启发式算法是和最优化算法相对的。 一般而言&am…

Axure移动端选择器案例:多类型选择器设计与动态效果实现

在移动端交互设计中&#xff0c;选择器是用户输入的核心组件。Axure移动端高保真元件库提供了四种关键选择器解决方案&#xff0c;通过动态效果提升操作真实感&#xff1a; 预览地址&#xff1a;Axure 1. 基础选择器 采用底部弹窗设计&#xff0c;支持单选项快速选择。点击触发…

Spring Boot图片验证码功能实现详解 - 从零开始到完美运行

Spring Boot图片验证码功能实现详解 - 从零开始到完美运行 &#x1f4d6; 前言 大家好&#xff01;今天我要和大家分享一个非常实用的功能&#xff1a;Spring Boot图片验证码。这个功能可以防止恶意攻击&#xff0c;比如暴力破解、刷票等。我们实现的是一个带有加减法运算的图片…

HarmonyOS实现快递APP自动识别地址

​ 大家好&#xff0c;我是潘Sir&#xff0c;持续分享IT技术&#xff0c;帮你少走弯路。《鸿蒙应用开发从入门到项目实战》系列文章持续更新中&#xff0c;欢迎关注&#xff01; 随着鸿蒙&#xff08;HarmonyOS&#xff09;生态发展&#xff0c;越来越多的APP需要进行鸿蒙适…

CUDA编程13 - 测量每个Block的执行时间

一:概述 GPU 程序性能不是靠 CPU 那样的“顺序执行”来衡量的,而是靠线程块(block)和多处理器(SM)利用率。每个 block 在 GPU 的不同多处理器上执行,顺序不确定。传统的 kernel 总体计时(比如 cudaEvent 计时整个 kernel)只能知道总时间,无法分析哪个 block 慢,为什…

敏捷开发-Scrum(下)

Scrum 核心构成&#xff1a;团队、事件与工件的协同价值体系 在 Scrum 框架中&#xff0c;“团队、事件、工件” 并非孤立的模块&#xff0c;而是相互咬合的有机整体&#xff1a;Scrum 团队是价值交付的执行核心&#xff0c;Scrum 事件是节奏把控与反馈调整的机制载体&#xff…

LeetCode 单调栈 739. 每日温度

739. 每日温度给定一个整数数组 temperatures &#xff0c;表示每天的温度&#xff0c;返回一个数组 answer &#xff0c;其中 answer[i] 是指对于第 i 天&#xff0c;下一个更高温度出现在几天后。如果气温在这之后都不会升高&#xff0c;请在该位置用 0 来代替。 示例 1: 输入…

Java-面试八股文-JVM篇

JVM篇 一.在JVM中&#xff0c;什么是程序计数器? 在 JVM&#xff08;Java Virtual Machine&#xff09; 中&#xff0c;程序计数器&#xff08;Program Counter Register&#xff0c;简称 PC 寄存器&#xff09; 是一块较小的内存空间&#xff0c;用于记录 当前线程所执行的字…

微算法科技(NASDAQ: MLGO)采用量子相位估计(QPE)方法,增强量子神经网络训练

随着量子计算技术的迅猛发展&#xff0c;传统计算机在处理复杂问题时所遇到的算力瓶颈日益凸显。量子计算以其独特的并行计算能力和指数级增长的计算潜力&#xff0c;为解决这些问题提供了新的途径。微算法科技&#xff08;NASDAQ: MLGO&#xff09;探索量子技术在各种应用场景…

MySQL 备份的方法和最佳实践

MySQL 是一种流行的开源关系数据库管理系统&#xff0c;用于在线应用程序和数据仓库。它以可靠性、有效性和简单性而闻名。然而&#xff0c;与任何计算机系统一样&#xff0c;由于硬件故障、软件缺陷或其他不可预见的情况&#xff0c;存在数据丢失的可能性。因此&#xff0c;保…

应用层自定义协议、序列化和反序列化

1.自定义协议开发者根据特定应用场景的需要&#xff0c;自行设计和制定的通信规则和数据格式 1.1 核心组成部分一个典型的自定义协议通常包含以下几个关键部分&#xff1a;​帧/报文格式 (Frame/Packet Format)​​&#xff1a;定义了数据是如何打包的。这通常包括&#xff1a…

Excel VBA 中可用的工作表函数

Visual Basic for Applications (VBA) 中可用的工作表函数。可以在 VBA 中通过 Application.WorksheetFunction 对象调用。 下面我将按照字母分组&#xff0c;对每个函数进行简要解释&#xff0c;并给出在 VBA 中使用的示例。A 组Acos: 返回数字的反余弦值。 result Applicati…

OpenWrt + Docker 完整部署方案:CFnat + Cloudflared 一体化集成

AI生成&#xff08;可能是AI幻觉&#xff09; 项目架构概述 基于您现有的网络配置&#xff08;IP: 192.168.1.1&#xff09;&#xff0c;本方案将CFnat服务作为网络优化层整合到现有的Cloudflare隧道架构中&#xff0c;实现完整的网络加速解决方案。 优化后的流量路径 用户访问…

苍穹外卖项目实战(day7-1)-缓存菜品和缓存套餐功能-记录实战教程、问题的解决方法以及完整代码

完整资料下载 通过网盘分享的文件&#xff1a;苍穹外卖 链接: https://pan.baidu.com/s/1JJaFOodXOF_lNJSUiZ6qtw?pwdps2t 提取码: ps2t 目录 1、缓存菜品 &#xff08;1&#xff09;问题说明 &#xff08;2&#xff09;使用redis缓存部分数据 1-2、代码完善 &#xff…

计算机毕业设计 基于Python+Django的医疗数据分析系统

精彩专栏推荐订阅&#xff1a;在 下方专栏&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb; &#x1f496;&#x1f525;作者主页&#xff1a;计算机毕设木哥&#x1f525; &#x1f496; 文章目录 一、项目介绍二…

使用 chromedp 高效爬取 Bing 搜索结果

在数据采集领域&#xff0c;搜索引擎结果是重要的信息来源。但传统爬虫面对现代浏览器渲染的页面时&#xff0c;常因 JavaScript 动态加载、跳转链接加密等问题束手无策。本文将详细介绍如何使用 Go 语言的chromedp库&#xff0c;模拟真实浏览器行为爬取 Bing 搜索结果&#xf…