### Create self-signed certificate.
[root@testos ~]# cd /etc/pki/tls/certs
[root@testos certs]# openssl req -x509 -nodes -newkey rsa:2048 -keyout vsftpd.pem -out vsftpd.pem -days 365
Generating a 2048 bit RSA private key
……++++++
…….++++++
writing new private key to ‘/etc/pki/tls/certs/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]:IR ### Country
State or Province Name (full name) [Some-State]:Tehran ### State
Locality Name (eg, city) []:Tehran ### City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:mycompany ### Company Name
Organizational Unit Name (eg, section) []:IT ### Department
Common Name (eg, YOUR name) []: www.unixtest.ir ### Server’s FQDN
Email Address []:xxx@test.ir ### Admin Email
### Set required permission
[root@testos ~]# chmod 400 /etc/pki/tls/certs/vsftpd.pem
### Configure vsftpd
[root@testos ~]# vi /etc/vsftpd/vsftpd.conf
# enable TLS
rsa_cert_file=/etc/pki/tls/certs/vsftpd.pem
ssl_enable=YES
ssl_ciphers=HIGH
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
### Restart vsftpd service
[root@testos ~]# systemctl restart vsftpd
### Configure FTP Client to use FTPS connection.
## Install FTP Client and configure it.(lftp)
[testuser@testos2 ~]$ vi ~/.lftprc
# create new
set ftp:ssl-auth TLS
set ftp:ssl-force true
set ftp:ssl-protect-list yes
set ftp:ssl-protect-data yes
set ftp:ssl-protect-fxp yes
set ssl:verify-certificate no
### Test lftp client connection
[testuser@testos2 ~]$ lftp -u testuser www.unixtest.ir
Password:
lftp testuser@www.unixtest.ir:~>