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

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…