How to build an FTP server in Linux
In this tutorial, I will introduce how to build your own FTP server. However, we should first learn what FTP is.
What is FTP?
FTP is the abbreviation of File Transfer Protocol. As the name implies, FTP is used for file transmission between computers over the network. You can transfer files between your computer account through FTP, transfer files between your account and your desktop computer, or access online software archiving. However, it should be noted that most FTP sites have very high usage and may need to be reconnected for multiple times.
The FTP address is very similar to the HTTP address (that is, the webpage address), but the FTP address uses the ftp: // prefix instead of http ://
What is an FTP server?
Generally, computers with FTP addresses are dedicated to receiving FTP connection requests. A computer dedicated to receiving FTP connection requests is an FTP server or FTP site.
Now, let's start a special adventure. We will build an FTP service to share files with family members and friends. In this tutorial, we will use vsftpd as the ftp service.
VSFTPD is the most secure FTP server software. In fact, the first two letters of VSFTPD indicate "very safe (very secure )". This software bypasses the FTP Protocol Vulnerability.
Even so, you should know that there are more secure methods for file management and transmission, such as SFTP (using OpenSSH ). The FTP protocol is very useful and reliable for sharing non-sensitive data.
Install VSFTPD with rpm:
You can use the following command to quickly install VSFTPD on the command line interface:
dnf -y install vsftpd
Use deb to install VSFTPD:
You can use the following command to quickly install VSFTPD on the command line interface:
sudoapt-get install vsftpd
Install VSFTPD in Arch:
You can use the following command to quickly install VSFTPD on the command line interface:
sudo pacman -S vsftpd
Configure the FTP service
Most VSFTPD configuration items are in the/etc/vsftpd. conf configuration file. This file is already well documented. Therefore, in this section, I only emphasize some important options that you may modify. Use the man page to view all available options and basic documentation instructions:
man vsftpd.conf
According to the file system level standard, FTP shared files are located in the/srv/ftp directory by default.
Upload allowed:
To allow ftp users to modify the file system content, such as uploading files, the "write_enable" flag must be set to YES.
write_enable=YES
Allow local (system) User Logon:
To allow users recorded in the file/etc/passwd to log on to the ftp service, the "local_enable" flag must be set to YES.
local_enable=YES
Anonymous User Logon
The following configuration controls whether anonymous users are allowed to log on:
# Allow anonymous users to log on
anonymous_enable=YES
# Password not required for anonymous logon (optional)
no_anon_password=YES
# Maximum transfer rate for anonymous logon, Bytes/second (optional)
anon_max_rate=30000
# Anonymous Logon directory (optional)
anon_root=/example/directory/
Root directory restriction (Chroot Jail)
Chroot jail is a security mechanism in unix-like systems. It is used to modify the root directory environment for running processes, this thread cannot perceive the existence of directory structures and files other than its root directory tree. For more information, see chroot jail)
Sometimes we need to set the root directory (chroot) environment to prevent users from leaving their home directory. Add/modify the following configuration in the configuration file to enable the root directory restriction (Chroot Jail ):
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
The "chroot_list_file" variable specifies the files/directories contained in the root directory)
Finally, you must restart the ftp service and enter the following command in the command line:
sudosystemctl restart vsftpd
So far, your ftp service has been set up and started.
Four Advanced configurations of vsftpd Server:
VsFTPd configuration Tutorial:
Simple and practical Ubuntu FTP setup
Set up FTP server and Apache server on Ubuntu
Install the LAMP \ vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Simple case of anonymous uploading of SeLinux and vsftpd on the RHEL6 Platform
Install vsftpd source code in Linux
Install and configure the FTP server vsftpd in openSUSE 13.2/13.1
Via: http://itsfoss.com/set-ftp-server-linux/
Author: alimiracle Translator: cvsher Proofreader: wxy
This article was originally compiled by LCTT and launched with the honor of Linux in China
This article permanently updates the link address: