Using Ubuntu 18.04, first use the apt command to install ftp
sudo apt install vsftpd
After the installation, you can actually run the ftp server. The configuration used is the default configuration. We can use netstat -ntl to view the ftp enabled port
You can see that the default port 21 is used, and then use the service command to view the status of the ftp server
**Then because the currently used ftp services are all running according to the default configuration, we can modify the configuration parameters according to our needs. The location of the vsftpd configuration file is /etc/vsftpd.conf. Let me talk about the first problem I encountered. There is a listen parameter (server monitoring) in the configuration file. This is to be turned on, but the default is NO, so I set it to YES, and then restart Server and check the status of the server, and found that status:failed appears, and there are two red parameters code=exited, status=2, here we need to change the parameter of listen_ipv6 to NO (this is the need to pay attention Yes, this problem will occur if listen and listen_ipv6 are YES at the same time). **
**We can customize a ftp directory, here I created the ftpserver/ftp folder under home, here I use ftpserver as the ftp server directory, and then modify the ftp folder permissions to allow users to read and write in ftp Operation. **
sudo mkdir -p ftpserver/ftp/
chmod 777 ftp
**Then we go to modify the configuration file, here I am going to modify the configuration file in a way that allows anonymous access. **
anonymous_enable=YES #Allow anonymous access
anon_root=/home/charles/ftpserver #Here is the directory of your ftp, here I use anonymous access, so it is anon_root
local_root=/home/charles/ftpserver #Here is the directory accessed by ordinary users
no_anon_password=YES #Anonymous users do not need to enter a password
write_enable=YES #Can write to it
anon_upload_enable=YES #Allow anonymous upload
anon_mkdir_write_enable=YES #Allow anonymous creation of folders
**Remember to restart the service after saving: service vsftpd restart, and then we can access the server through ftp+ip. The following is an anonymous example for access and upload and download operations. We created a test folder in the home directory, then touched a file in this folder, then touched a file b in the ftp folder, and then accessed the ftp server in the test folder. **
**In the ftp folder, we can download files from the server through get and upload files through put. Take the above example as an example, put a and get b. Then exit through commands such as quit or exit or bye. Then the final result is shown below: **
**The above is the simple operation of ftp. For uninstalling the ftp server, use the following command, --purge is used to completely delete related files. **
sudo apt-get remove --purge vsftpd
Recommended Posts