温馨提示×

Ubuntu vsftpd SSL证书配置方法

小樊
37
2025-11-06 15:22:32
栏目: 云计算

Here’s a concise guide to configuring SSL certificates for vsftpd on Ubuntu:

1. Install vsftpd

Update your package list and install vsftpd:

sudo apt update
sudo apt install vsftpd

2. Obtain an SSL Certificate

You can use Let’s Encrypt (free) or purchase a commercial certificate. For Let’s Encrypt:

sudo apt install certbot
sudo certbot certonly --standalone -d yourdomain.com

This creates certificates at /etc/letsencrypt/live/yourdomain.com/ (fullchain.pem and privkey.pem).

3. Configure vsftpd for SSL

Edit the vsftpd configuration file:

sudo nano /etc/vsftpd.conf

Add/modify these settings:

ssl_enable=YES
rsa_cert_file=/etc/letsencrypt/live/yourdomain.com/fullchain.pem
rsa_private_key_file=/etc/letsencrypt/live/yourdomain.com/privkey.pem
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
allow_anon_ssl=NO
local_enable=YES
write_enable=YES

Save and exit (Ctrl+O, Enter, Ctrl+X).

4. Restart vsftpd

Apply changes by restarting the service:

sudo systemctl restart vsftpd

5. Configure the Firewall

Allow FTP (port 21) and FTPS (port 990) traffic:

sudo ufw allow 21/tcp
sudo ufw allow 990/tcp
sudo ufw reload

6. Test the Configuration

Use an FTP client like FileZilla to connect to your server. Select “FTPES” (explicit TLS) as the encryption method. You should see a secure connection established.

0