温馨提示×

vsftpd在Debian上如何实现SSL加密

小樊
45
2026-01-03 11:28:43
栏目: 云计算

要在Debian上为vsftpd实现SSL加密,你需要按照以下步骤操作:

  1. 安装vsftpd: 在Debian终端中输入以下命令来安装vsftpd:

    sudo apt-get update
    sudo apt-get install vsftpd
    
  2. 安装Certbot: Certbot是一个自动获取和安装Let’s Encrypt SSL证书的工具。在Debian终端中输入以下命令来安装Certbot:

    sudo apt-get install certbot python3-certbot-ftp
    
  3. 获取SSL证书: 使用Certbot获取SSL证书。在Debian终端中输入以下命令:

    sudo certbot --ftp --cert-name yourdomain.com --email your-email@example.com --agree-tos --non-interactive
    

    yourdomain.com替换为你的域名,将your-email@example.com替换为你的电子邮件地址。Certbot会自动创建一个名为/etc/letsencrypt/live/yourdomain.com的目录,其中包含你的SSL证书和私钥文件。

  4. 配置vsftpd: 编辑vsftpd配置文件以启用SSL加密。在Debian终端中输入以下命令:

    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
    

    yourdomain.com替换为你的域名。保存并关闭文件。

  5. 重启vsftpd服务: 在Debian终端中输入以下命令以重启vsftpd服务:

    sudo systemctl restart vsftpd
    

现在,你的vsftpd服务器已经启用了SSL加密。用户可以通过FTPS(FTP over SSL)连接到你的服务器,使用端口990进行隐式连接或端口21进行显式连接。

0