Virtual machine Linux system builds FTP server

Virtual machine Linux system builds FTP server

1. We want to build an FTP server in a virtual machine. First, our virtual machine needs to be configured with a yum source. If it is not configured, please refer to the description of adding a link
. 2. After configuring the yum source, we need to install an FTP software first. The command is as follows:

[root@red ~]# yum -y install vsftpd 

(Install the software for FTP)
3. After the software is installed, it will automatically create a subdirectory under the /var directory. The name of the subdirectory is ftp (/var/ftp). Here we use the ls command to check it.

[root@red ~]# ls /var/ftp

(Confirm whether there is such a directory, and the content in the directory)
4. After installing the vsftpd software, start the service (program). After starting, the vsftpd software will share the /var/ftp directory to everyone (everyone who can network with themselves How
to start and close the service in Linux system, check the service status:
systemctl start <service name> (command to start the service);
systemctl stop <service name> (command to close the service);
systemctl status <service name> (Check the command of the service);
5. At this time, we will start the vsftpd software, the command is as follows

[root@red ~]# systemctl start vsftpd 

(Start up the software vsftpd)
6. Let’s check the status of vsftpd, the command is as follows

[root@red ~]# systemctl status vsftpd

(Check the status)
If there is green running in the output result, it means that the service has been started.
Black dead means that the service has been closed.
7. At this time, our FTP server has been set up, and we access it in another virtual machine. The command is as follows

[root@server1 ~]# firefox ftp://172.25.0.25

(172.25.0.25 is the IP of the red virtual machine)
8. We may not be able to access it at this time, because the Linux system has a firewall by default, which will block users from accessing! (For convenience, temporarily set the firewall to trust all), the command is as follows

[root@red ~]# firewall-cmd --set-default-zone=trusted 

(set firewall to trust all)

[root@red ~]# vim /etc/vsftpd/vsftpd.conf 

(The user and password are required to access ftp by default.)
Scroll down with the arrow keys and find anonymous_enable=NO.
The default is in the command mode. If you enter i to enter the edit mode, change NO to YES. The result is as follows:
anonymous_enable=YES (whether anonymous access is allowed)
After the modification, press ESC to return to the command mode, and then enter: wq, then we have completed the modification, and anyone can access it again, and there is no interception.
9. At this time, we need to restart vsftpd, the command is as follows

[root@red ~]# systemctl restart vsftpd

10. To verify whether FTP can be accessed, we need to access it on the host (using the browser of server1), the command is as follows

[root@server1 ~]# firefox ftp://172.25.0.25 

(172.25.0.25 is the IP of the red virtual machine)
How do you want to see more file sharing in the browser, you can create more directories or files in /var/ftp/, so that you can access the FTP in the virtual machine Check out some documentation.

Guess you like

Origin blog.csdn.net/qq_51344334/article/details/111691522