Adding SSL encryption to vsftpd

There may be some situations where you want to encrypt FTP traffic with SSL certificates rather than using SFTP with SSH. Using vsftpd with SSL encryption is quite easy, and here's how it's done:

First, you'll need to make a new self-signed SSL certificate (if you don't have a key and certificate available already):

openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout server.key -out server.crt

Once you have the key and certificate made, you'll need to concatenate them into a PEM file:

# cat server.key > /etc/vsftpd/server.pem
# cat server.crt >> /etc/vsftpd/server.pem

Now, simply adjust the vsftpd configuration file to enable SSL encryption:

ssl_enable=YES
force_local_data_ssl=NO
force_local_logins_ssl=NO
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=YES
rsa_cert_file=/etc/vsftpd/server.pem

Once that's complete, restart vsftpd and you will be able to connect to your FTP server using SSL/TLS encryption.

Further Reading:
Manpage of vsftpd.conf

Printed from: http://rackerhacker.com/2007/11/26/adding-ssl-encryption-to-vsftpd/ .
© Major Hayden 2012.

4 Comments   »

  • Charles says:

    What if I want to put in a signed cert as opposed to a self-signed one? Would the procedures change for that?

  • major says:

    Charles,

    You'd just need to put your swap in your private key and signed cert into the .pem file, but that'd be about it. Of course, if your CA has intermediate certificates, be sure to add them to the end of the .pem file.

  • Corbin says:

    Thank u after searching for a while this helped me out:) !

  • c0smic (Jack) says:

    THANK YOU!!
    I'd been having problems creating a cert for an hour or two now, and this solved everything!
    Thank you for your extremely easy to read guide

RSS feed for comments on this post

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this