在Debian上配置FTP SSL加密,通常需要使用vsftpd
(Very Secure FTP Daemon)软件,并为其配置SSL/TLS支持。以下是详细步骤:
首先,确保你的系统是最新的,然后安装vsftpd
。
sudo apt update
sudo apt install vsftpd
编辑vsftpd
的配置文件/etc/vsftpd.conf
。
sudo nano /etc/vsftpd.conf
在文件中添加或修改以下配置项:
# 启用SSL/TLS
ssl_enable=YES
# 强制使用SSL/TLS
force_local_data_ssl=YES
force_local_logins_ssl=YES
# 使用SSL/TLS证书和密钥
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
# 允许匿名用户使用SSL/TLS
allow_anon_ssl=NO
# 允许本地用户使用SSL/TLS
local_enable=YES
write_enable=YES
# 其他安全设置
chroot_local_user=YES
allow_writeable_chroot=YES
# 日志记录
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=NO
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
如果你还没有SSL/TLS证书和密钥,可以使用openssl
生成自签名证书。
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem
按照提示输入相关信息,例如国家、组织名称等。
保存并关闭配置文件后,重启vsftpd
服务以应用更改。
sudo systemctl restart vsftpd
确保防火墙允许FTP流量。如果你使用的是ufw
,可以这样配置:
sudo ufw allow 21/tcp
sudo ufw allow 990/tcp # FTPS数据连接
sudo ufw enable
使用FTP客户端连接到你的服务器,确保SSL/TLS加密正常工作。例如,使用lftp
:
lftp -e 'open ftp://your_server_ip; user your_username your_password; ls; quit'
如果一切配置正确,你应该能够看到服务器上的文件列表,并且连接是加密的。
通过以上步骤,你应该能够在Debian上成功配置FTP SSL加密。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: Debian Nginx如何实现负载均衡