在Ubuntu系统下配置vsftpd(Very Secure FTP Daemon)服务器的防火墙涉及几个步骤。以下是详细的配置指南:
sudo apt update
sudo apt install ufw
sudo ufw enable
sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
/etc/vsftpd.conf
:sudo nano /etc/vsftpd.conf
进行以下配置:
anonymous_enable NO
local_enable YES
chroot_local_user YES
write_enable YES
sudo systemctl restart vsftpd
使用以下命令验证防火墙设置是否正确:
sudo ufw status
确保端口20和21已打开,并且VSFTPD服务正在运行。
/etc/vsftpd.conf
文件中的 chroot_local_user
和 allow_writeable_chroot
选项来限制用户访问其主目录。sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/certs/vsftpd.pem
然后在vsftpd配置文件中启用SSL/TLS:
ssl_enable YES
rsa_cert_file /etc/ssl/private/vsftpd.pem
rsa_private_key_file /etc/ssl/private/vsftpd.pem
重启vsftpd服务以使更改生效:
sudo systemctl restart vsftpd
通过以上步骤,你可以在Ubuntu上成功配置vsftpd服务器的防火墙设置,确保FTP服务能够正常访问,同时保证系统的安全性。