Warning: copy(/var/www/html/dreamsites_wp_2018/wp-content/wflogs//GeoLite2-Country.mmdb): Failed to open stream: Permission denied in /var/www/html/dreamsites_wp_2018/wp-content/plugins/wordfence/lib/wordfenceClass.php on line 2149
» Install VSFTPD in Ubuntu and AWS
 

Install VSFTPD in Ubuntu and AWS

25th December 2018 posted in General, Ubuntu

How to install VSFTPD and add a secure certificate for it

You can quickly install vsftpd on your virtual private server in the command line:

sudo apt-get install vsftpd

Open up the configuration file:

sudo nano /etc/vsftpd.conf

Here are all the settings you will need to connect to the ftp server from Sublime Sftp and FileZilla

listen=YES
anonymous_enable=NO
write_enable=YES
local_umask=022
anonymous_enable=NO
connect_from_port_20=YES
chroot_local_user=YES
allow_writeable_chroot=YES
ssl_enable=YES
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
pasv_enable=YES
port_enable=YES
pasv_min_port=40000
pasv_max_port=40100
pasv_addr_resolve=NO
pasv_address=your_server_ip
force_dot_files=YES

Now generate the SSL file to secure FTP

The below command will generate the certificate for 1 year, just increase the days to whatever you like, eg -days 3650 for 10 years

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem

Generating a 2048 bit RSA private key
............................................................................+++
...........+++
writing new private key to '/etc/ssl/private/vsftpd.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:NY
Locality Name (eg, city) []:New York City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Dream Sites Ltd
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []: your_server_ip
Email Address []:

Now you have to open up the TCP ports in the AWS security group

Open up the TCP port range as specified above 40000-40100 in the AWS security group. You will also need to ensure port 21 is open.

Now you are ready to access FTP from FileZilla or Sublime Sftp

Tags: FTP, SSL