在Linux上啟用FTP服務器的SSL加密,通常需要以下幾個步驟:
首先,確保你已經安裝了一個FTP服務器軟件。常見的FTP服務器軟件有vsftpd、ProFTPD和Pure-FTPd等。
sudo apt update
sudo apt install vsftpd
你需要一個SSL證書來啟用SSL加密。你可以使用Let’s Encrypt免費生成證書。
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com
按照提示完成證書的獲取和配置。
編輯vsftpd的配置文件:
sudo nano /etc/vsftpd.conf
添加或修改以下配置項:
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
rsa_cert_file=/etc/letsencrypt/live/yourdomain.com/fullchain.pem
rsa_private_key_file=/etc/letsencrypt/live/yourdomain.com/privkey.pem
保存并退出編輯器。
sudo systemctl restart vsftpd
確保防火墻允許FTP和SSL流量。
sudo ufw allow 21/tcp
sudo ufw allow 990/tcp # FTPS控制端口
sudo ufw allow 40000:50000/tcp # 被動模式端口范圍
sudo ufw enable
使用FTP客戶端連接到你的服務器,并驗證是否使用了SSL加密。
通過以上步驟,你應該能夠在Linux上成功啟用FTP服務器的SSL加密。