A, requirements,

The so-called “one Java, one operation and maintenance”, we develop Javaweb projects (regardless of SSM or Springboot), generally will use VMware software, and install the centos system on the software, how to deploy the developed project to the centos system.

In terms of file transfer, FileZilla is generally used to transfer files between the centos server and the local computer. FTP requests are used to transfer files, which requires the FTP component to be installed on the centos system. This section describes how to install the FTP component on centos.

2. Specific steps

1. Install the VSFTPD component

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

2. Add an FTP user

[root@bogon ~]# useradd ftpuser

Once you’ve created a user like this, you can log in with this user, and remember to log in with normal users instead of anonymous ones. The default path is /home/ftpuser.

3. Add a password to the FTP user

[root@bogon ~]# passwd ftpuser    mypassword

Enter the password twice to change the password.

4. Firewall enable port 21 or disable the firewall (this version is centos7, not applicable to centos6.5 or earlier versions), and enable the FTP service

Add firewall-cmd –zone=public –add-port=20/ TCP –permanent (–permanent) Reload firewall-cmd –reload Check firewall-cmd –zone= public –query-port=20/ TCP

Run the systemctl status firewald. service command to check the firewall status.

Run the systemctl stop firewald. service command to disable the firewall

Run the systemctl start firewalld. Service command to enable the firewall

Su – root # Switch to root

Service VSFTPD status

Service VSFTPD start # Enable the FTP service

5. Modify selinux

Extranet is accessible, but can’t return to directory (FTP active mode, passive mode is still not accessible), and can’t upload due to selinux bug.

Modify the selinux:

Run the following command to check the status:

[root@bogon ~]# getsebool -a | grep ftp  

allow_ftpd_anon_write –> off

allow_ftpd_full_access –> off

allow_ftpd_use_cifs –> off

allow_ftpd_use_nfs –> off

ftp_home_dir –> off

ftpd_connect_db –> off

ftpd_use_passive_mode –> off

httpd_enable_ftp_server –> off

tftp_anon_write –> off

[root@bogon ~]#

Execute the command above, and then return the result to see both lines are off, indicating that the access to the Internet is not enabled

[root@bogon ~]# setsebool -P allow_ftpd_full_access on

[root@bogon ~]# setsebool -P ftp_home_dir on

 

If so, see if you are using the FTP client and accessing the FTP client in passive mode. If you say “Entering passive mode”, it means Entering passive mode. As FTP passive mode is blocked by iptables, how to enable it will be explained below. If you are too lazy to enable it, check whether your FTP client has port mode or remove passive mode. If the client still does not work, check to see if the host computer on the client is firewall enabled.

Add: FileZilla active, passive mode modification: menu: edit → Settings

 

6. Disable anonymous access

/etc/vsftp/vsftpd. conf

Restarting the FTP service:

[root@bogon ~]# service vsftpd restart

7. Go into passive mode

If there is no step 7, FileZilla connects successfully but fails to read the directory

This is enabled by default, but to specify a port range, open the vsftpd.conf file and add

pasv_enable=YES

pasv_min_port=30000

pasv_max_port=30999

Indicates that the port number ranges from 30000 to 30999. This parameter can be changed at will. After the change, restart VSFTPD

Since this port range is specified, iptables must also be enabled accordingly, so open the iptables file as above.

Change 21 to 3000:30999, then :wq save, restart iptables. And we’re done.

vi /etc/vsftpd/vsftpd.conf

Restarting the FTP service:

[root@bogon ~]# service vsftpd restart

8. Enable the VSFTPD FTP service

[root@bogon ~]# chkconfig vsftpd on

Play code every day, progress every day!