Home  >  Article  >  System Tutorial  >  Complete guide to install FTPS service on Linux system

Complete guide to install FTPS service on Linux system

王林
王林Original
2024-03-19 11:39:031035browse

Title: A complete guide to installing FTPS service under Linux system

In Linux system, setting up an FTP server is a common requirement. However, in order to enhance the security of data transmission, we can choose to install the FTPS service, which adds SSL/TLS encryption function based on the FTP protocol. Through the FTPS service, we can upload and download files while ensuring the security of data transmission. This article will provide a detailed guide for installing FTPS service under Linux system, and provide specific code examples to help readers quickly achieve this goal.

Step 1: Install vsftpd

First, we need to install vsftpd (Very Secure FTP Daemon) as the implementation of the FTP server. vsftpd is available on most Linux distributions.

sudo apt update
sudo apt install vsftpd

Step 2: Configure vsftpd

After the installation is complete, we need to configure vsftpd to enable the FTPS function. First, back up the original configuration file:

sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak

Then, edit the vsftpd configuration file:

sudo nano /etc/vsftpd.conf

In the opened configuration file, add the following content:

ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

Step 3: Generate SSL certificate

Next, we need to generate an SSL certificate to encrypt data transmission. Execute the following command:

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

Step 4: Restart the vsftpd service

After the configuration is completed, restart the vsftpd service to make the changes take effect:

sudo systemctl restart vsftpd

Step 5: Firewall configuration

If the firewall is enabled in the system, you need to configure the firewall to allow FTP data transmission ports (default ports 20 and 21), as well as the ports required for FTP SSL/TLS data transmission (usually port 990):

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

Step 6: Test the FTPS service

Now, you can use the FTP client to connect to your FTPS server and upload and download files. Make sure to configure the FTP client to use an SSL/TLS connection and verify that the data transfer is encrypted.

Through the above six steps, you have successfully installed and configured the FTPS service under the Linux system to achieve secure file transfer functions. I hope this article has helped you in the process of setting up an FTP server, and that you can successfully build a stable, safe and reliable FTPS service.

The above is the detailed content of Complete guide to install FTPS service on Linux system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn