您應該在 CentOS 7.2 服務器上設置工做的 PureFTPd 設置,例如本教程所示:在 CentOS 7.2 上具備 PureFTPd、MariaDB 和虛擬用戶的 FTP 服務器(包括配額和帶寬管理)node
TLS 須要開放 SSL;要安裝 OpenSSL,咱們只需運行:centos
yum -y install openssl
打開/etc/pure-ftpd/pure-ftpd.conf...服務器
nano /etc/pure-ftpd/pure-ftpd.conf
若是要容許 FTP和TLS 會話,請將TLS設置爲1:session
[...] # This option can accept three values : # 0 : disable SSL/TLS encryption layer (default). # 1 : accept both traditional and encrypted sessions. # 2 : refuse connections that don't use SSL/TLS security mechanisms, # including anonymous sessions. # Do _not_ uncomment this blindly. Be sure that : # 1) Your server has been compiled with SSL/TLS support (--with-tls), # 2) A valid certificate is in place, # 3) Only compatible clients will log in. TLS 1 [...]
若是隻想接受 TLS 會話(無 FTP),則將TLS設置爲2:ui
[...] # This option can accept three values : # 0 : disable SSL/TLS encryption layer (default). # 1 : accept both traditional and encrypted sessions. # 2 : refuse connections that don't use SSL/TLS security mechanisms, # including anonymous sessions. # Do _not_ uncomment this blindly. Be sure that : # 1) Your server has been compiled with SSL/TLS support (--with-tls), # 2) A valid certificate is in place, # 3) Only compatible clients will log in. TLS 2 [...]
要根本不容許 TLS(僅 FTP),請將TLS設置爲0:this
[...] # This option can accept three values : # 0 : disable SSL/TLS encryption layer (default). # 1 : accept both traditional and encrypted sessions. # 2 : refuse connections that don't use SSL/TLS security mechanisms, # including anonymous sessions. # Do _not_ uncomment this blindly. Be sure that : # 1) Your server has been compiled with SSL/TLS support (--with-tls), # 2) A valid certificate is in place, # 3) Only compatible clients will log in. TLS 0 [...]
而後刪除如下 2 行前面的 #:spa
TLSCipherSuite HIGH CertFile /etc/ssl/private/pure-ftpd.pem
並保存更改的配置文件。插件
爲了使用 TLS,咱們必須建立 SSL 證書。我在/etc/ssl/私有/中建立它,所以我首先建立該目錄:rest
mkdir -p /etc/ssl/private/
以後,咱們能夠按照以下方式生成 SSL 證書:code
openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
國家/地區名稱 (2 個字母代碼) [XX]: <-- 輸入您的國家/地區名稱(例如,"DE")。*州或省名(全名)*:<-- 輸入您所在的州或省名。
**地名(例如,城市)[默認城市]: <-- 輸入您的城市。
**組織名稱(例如公司)[默認公司]:<-- 輸入您的組織名稱(例如,公司名稱)。
**組織單位名稱(如部分)[:<-- 輸入您的組織單位名稱(例如"IT 部門")。
**通用名稱(例如,您的姓名或服務器的主機名)[:]--輸入系統徹底限定的域名(例如"server1.example.com")。
電子郵件地址 [:<-- 輸入您的電子郵件地址。
*
更改 SSL 證書的權限:
chmod 600 /etc/ssl/private/pure-ftpd.pem
最後,從新啓動 PureFTPd:
systemctl restart pure-ftpd.service
就是這樣。如今,您能夠嘗試使用 FTP 客戶端進行鏈接;可是,您應該將 FTP 客戶端配置爲使用 TLS - 請參閱下一章如何使用 FileZilla 執行此操做。
爲了將 FTP 與 TLS 一塊兒使用,您須要一個支持 TLS 的 FTP 客戶端,例如FileZilla或 Firefox FireFTP 插件。
在 FileZilla 中,打開站點管理器:
選擇使用純FTPd與 TLS 的服務器;在"服務器類型"下拉菜單中,選擇"經過 TLS 要求顯式 FTP",而不是普通FTP:
如今,您能夠鏈接到服務器。若是首次執行此操做,則必須接受服務器的新 SSL 證書,由於咱們在此處使用自簽名 SSL 證書:
若是一切順利,您如今應該登陸到服務器上: