Table of contents
3. Classification of connection modes
4. How active and passive modes work
1. Configure anonymous user FTP service
1.1 Install FTP server software
2. Turn off the firewall and install the vsftpd software package
3. Open the FTP service and make a backup
4. Modify the configuration file
5. Set the permissions under the directory to facilitate users to upload data
7. Anonymous access on win machine
10. Set the root directory that is imprisoned when the user logs in
11. The command to set the black and white list of users is:
1. Overview of FTP
FTP (File Transfer Protocol) is a protocol for file transfer over the network. It is a standard Internet protocol used to transfer files between computers. FTP is a client-server protocol. The client connects to the FTP server through FTP client software, and then transfers files.
1. The concept of FTP
The idea behind FTP is to transfer files from one computer to another. The FTP client software can connect to the FTP server, and then transfer files through the FTP protocol. FTP client software can run on Windows, Mac, Linux and other operating systems.
2.FTP data connection mode
The FTP data connection mode refers to the way to establish a data connection between the FTP client and the FTP server. FTP data connection mode is divided into active mode and passive mode.
3. Classification of connection modes
The FTP connection mode is divided into active mode and passive mode. In the active mode, the FTP client sends a data connection request to the FTP server, and the FTP server sends data to the FTP client. In passive mode, the FTP client sends a data connection request to the FTP server, and the FTP server sends data to the FTP client.
4. How active and passive modes work
In the active mode, the FTP client sends a data connection request to the FTP server, and the FTP server sends data to the FTP client. In passive mode, the FTP client sends a data connection request to the FTP server, and the FTP server sends data to the FTP client.
2. Configure FTP service
To configure the FTP service, you need to disable the firewall first, and then install the vsftpd software package. Next, you need to enable the FTP service and make a backup, modify the configuration file, set the permissions under the directory to facilitate users to upload data, and finally restart the service.
1. Configure anonymous user FTP service
Anonymous user FTP service is a common file transfer protocol, which allows users to access files on the FTP server without logging in. Configuring the anonymous user FTP service is very simple, just follow the steps below.
1.1 Install FTP server software
First, you need to install the FTP server software. Common FTP server software includes vsftpd, proftpd, etc. In Ubuntu system, you can use the following command to install vsftpd:
sudo apt-get update
sudo apt-get install vsftpd
1.2 Configure FTP server
After the installation is complete, you need to configure the FTP server. Open the configuration file /etc/vsftpd.conf of vsftpd and find the following two lines:
anonymous_enable=YES
anon_root=/var/ftp
Set the value of anonymous_enable to YES to allow anonymous users to access the FTP server; set the value of anon_root to the root directory of the FTP server, which is /var/ftp here.
1.3 Restart the FTP server
After modifying the configuration file, you need to restart the FTP server to make the configuration take effect. Restart vsftpd with the following command:
sudo service vsftpd restart
1.4 Test FTP server
After the configuration is complete, you can use the FTP client to test whether the FTP server works normally. Enter the IP address and port number (21 by default) of the FTP server in the FTP client, and you can log in to the FTP server without entering a user name and password.
2. Turn off the firewall and install the vsftpd software package
On the Linux system, you need to turn off the firewall first, and then install the vsftpd software package. The command to turn off the firewall is:
systemctl stop firewalld
The command to install the vsftpd package is:
yum install vsftpd
3. Open the FTP service and make a backup
The command to enable the FTP service is:
systemctl start vsftpd
In order to prevent the configuration file from being modified, a backup is required. The backup command is:
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak
4. Modify the configuration file
The command to modify the configuration file is:
vi /etc/vsftpd/vsftpd.conf
Add the following to the configuration file:
anonymous_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_root=/var/ftp/pub
5. Set the permissions under the directory to facilitate users to upload data
The command to set the permissions under the directory is:
chmod 777 /var/ftp/pub
6. Restart the service
The command to restart the service is:
systemctl restart vsftpd
7. Anonymous access on win machine
On a Windows machine, you can use IE browser to access the FTP server. Enter ftp://IP address in the IE browser to access the FTP server.
8. Receive files under pub
In the IE browser, you can see the files in the pub directory. Files can be dragged to a local computer to download.
9. Local user ftp access
configuration file
On Linux systems, configuration files need to be modified. The command to modify the configuration file is:
vi /etc/vsftpd/vsftpd.conf
Add the following to the configuration file:
local_enable=YES
write_enable=YES
local_umask=022
chroot_local_user=YES
userlist_enable=YES
userlist_file=/etc/vsftpd/user_list
userlist_deny=NO
10. Set the root directory that is imprisoned when the user logs in
The command to set the root directory that is locked when the user logs in is:
usermod -d /var/ftp/user username
Set the blacklist and whitelist of users
11. The command to set the black and white list of users is:
vi /etc/vsftpd/user_list
Add the following to the file:
username
username2
Summarize
FTP is a protocol for file transfer over the network. The FTP client software can connect to the FTP server, and then transfer files through the FTP protocol. FTP data connection mode is divided into active mode and passive mode. On the Linux system, you need to turn off the firewall first, and then install the vsftpd software package. Next, you need to enable the FTP service and make a backup, modify the configuration file, set the permissions under the directory to facilitate users to upload data, and finally restart the service. On a Windows machine, you can use IE browser to access the FTP server. Enter ftp://IP address in the IE browser to access the FTP server.