第1步:在Ubuntu上安装VSFTPD
要在Ubuntu上安装vsftpd,请运行以下命令。
sudo apt update sudo apt-get install vsftpd
安装VSFTPD后,下面的命令可用于停止,启动和启用vsftpd服务
sudo systemctl stop vsftpd.service sudo systemctl start vsftpd.service sudo systemctl enable vsftpd.service
第3步:重新启动VSFTPD服务器
运行以下命令以重新启动VSFTPD服务器。
sudo systemctl restart vsftpd
现在可以使用FTP客户端连接并测试。
第3步:配置VSFTPD以使用SSL/TLS
打开VSFTPD默认配置文件。
sudo nano /etc/vsftpd.conf
配置下面的内容,以便通过SSL/TLS进行通信
# This option specifies the location of the RSA certificate to use for SSL # encrypted connections. rsa_cert_file=/etc/ssl/certs/vsftpdcertificate.pem rsa_private_key_file=/etc/ssl/private/vsftpdserverkey.pem ssl_enable=YES allow_anon_ssl=NO force_local_data_ssl=YES force_local_logins_ssl=YES require_ssl_reuse=NO ssl_ciphers=HIGH ssl_tlsv1=YES ssl_sslv2=NO ssl_sslv3=NO
第2步:创建一个自签名的SSL/TLS证书
运行以下命令以为服务器生成自签名的SSL/TLS证书。
这些命令创建名为vsftpdserverkey.pem的服务器密钥,并将其存储在/etc/ssl/private中,
vsftpdcertificate.pem的证书文件,保存在/etc/ssl/certs中。
sudo openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/ssl/private/vsftpdserverkey.pem -out /etc/ssl/certs/vsftpdcertificate.pem -days 365
系统会提示我们回答关于证书的几个问题。
Generating a 2048 bit RSA private key . . . . . . . . . . . . . ..+++ .+++ writing new private key to '/etc/ssl/private/vsftpdserverkey.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]:New York Locality Name (eg, city) []:Brooklyn Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Example Organizational Unit Name (eg, section) []:SSL Unit Common Name (e.g. server FQDN or YOUR name) []:example.com Email Address []:webmaster@example.com
日期:2020-07-07 20:55:43 来源:oir作者:oir