11.2 VSFTPD Introduction
VSFTPD is an open source FTP server that is licensed under the GPL for a variety of UNIX and Linux systems. VSFTPD, also known as very secure FTP Daemon, is a secure, fast, and stable FTP server that can handle a large number of concurrent connections efficiently.
11.2.1 VSFTPD software package acquisition and installation
Key features of the VSFTPD include:
Provides a secure architecture that performs each task individually, based on the minimum privileged requirements of the task.
Support virtual IP configuration, you can establish multiple FTP servers in the domain with an IP address.
Allows the configuration and use of virtual users to separate from the system user account.
TCP encapsulation is supported.
Allows the configuration of anonymous servers, which allow users to upload and download files without the need for authentication.
Stable performance, can handle a large number of concurrent connections.
Can be configured as a standalone server.
The VSFTPD server supports bandwidth control.
Almost all Linux distributions have built-in VSFTPD services, and Red Hat Enterprise Linux 5 has its own VSFTPD service. For Red Hat Enterprise Linux 5 with VSFTPD installed, you can select the Package Manager option in Applications | Add/Remove software to view the VSFTPD service, as shown in 11.1.
You can also check that the system has the VSFTPD package installed by executing the following command at the terminal:
# Rpm-qa|grep VSFTPD
Vsftpd-2.0.5-10.el5
If the above results appear, VSFTPD-2.0.5-10.EL5.I386.RPM is installed.
There are two ways to install VSFTPD software packages.
1. Manually installing the VSFTPD package
Users can download the required vsftpd RPM installation package on the http://vsftpd.beasts.org/, or find the RMP that need to be installed in the red Hat Enterprise Linux 5 installation disk and install it with the RPM-IVH command. You need to have root access to the system when installing RMP. For example, to install VSFTPD-2.0.5-10.EL5.I386.RPM, use the following command:
# RPM-IVH vsftpd-2.0.5-10.el5.i386.rpm
(Click to view larger image) Figure 11.1 View VSFTPD Package
2. Compiling installations based on source code
If you need a later version or need to customize the installation process, you can use the VSFTPD source code to compile the installation. Source code can be downloaded from the http://vsftp.beasts.org website, the latest version is vsftpd-2.0.5.tar.gz. In the default configuration, VSFTPD needs to use the nobody user and the/usr/share/empty directory. When you install red Hat Enterprise Linux 5 o'clock, nobody users, and/usr/share/empty directories are created automatically. You can test whether the user and directory already exist by using the following command and create the user and directory if it does not exist.
# Useradd Nobody
# Mkdir/usr/share/empty
If the nobody user already exists, the system will prompt "Useradd: User nobody already exists". If the directory/usr/share/empty directory already exists, the system will prompt "directory already exists."
If you need VSFTPD support for anonymous services, you should create an FTP user with the following command and have the permissions of the home directory:
# mkdir/var/ftp
# useradd-d/var/ftp FTP
# chown Root.root/var/ftp
# chmod Og-w/var/ftp
After the user and directory permissions are set up, you can compile the installation by using the following command:
# TAR-ZXVF Vsftpd-2.0.5.tar.gz
# CD vsftpd-2.0.5
# make
# make Install
After the installation is complete, the configuration file needs to be copied to the/etc directory:
# CP vsftpd.conf/etc/
Then use the following command to allow local users to log on to the server:
# CP Redhat/vsftpd.pam/etc/pam.d/ftp
Finally, edit the configuration file/etc/vsftpd.conf, add Listen=yes to the last line, and save.
Start VSFTPD by entering the following command at the command line:
# VSFTPD &
[1] 3457
& indicates that VSFTPD is running in the background. The vsftpd of the compiled installation can be detected with the following command:
# FTP localhost
Connected to teacher.bit.edu.cn.
(VsFTPd 2.0.5)
530 Login with USER and PASS.
530 Login with USER and PASS.
Kerberos_v4 rejected as an authentication type
Name (localhost:root): Anonymous
331 Specify the password.
Password:
Successful Login.
Remote system type is UNIX.
Using binary mode to transfer files.
FTP> ls
227 Entering Passive Mode (127,0,0,1,71,146)
Here comes the directory listing.
Drwxr-xr-x 2 0 0 4096 Jan
226 Directory send OK.
FTP> bye
221 Goodbye.
Here are a few explanations for the above test results.
# FTP localhost
Indicates that the local server is connected.
(VsFTPd 2.0.5)
Indicates that Vsftpd2.0.5 is the version of the installed VSFTPD.
Name (localhost:root): Anonymous
Represents the input user name, which is an anonymous (anonymous) user.
Password:
Indicates that the password should be entered after password, but the password content entered is not displayed under the Linux terminal.
Login Successful
Prompt for logon success.
Ftp> ls
At the "ftp>" prompt, the LS command is used to view the files on the server while the VSFTPD service is in use.
ftp> bye 221 Goodbye.
Indicates exiting the VSFTPD server.
When the installation is complete, you can see that the VSFTPD file layout structure is concise, as shown in table 11.1.
Table 11.1 vsftpd File layout
/etc/vsftpd/vsftpd.conf
Master configuration file
/usr/sbin/vsftpd
VSFTPD's main program
/etc/rc.d/init.d/vsftpd
Startup scripts
/etc/pam.d/vsftpd
Pam Certification File
/etc/vsftpd.ftpusers
Prohibit the use of VSFTPD user list files
/etc/vsftpd.user_list
Prohibit or allow the use of VSFTPD user list files
/var/ftp
Anonymous user home Directory
/var/ftp/pub
Download directory for anonymous users
In addition, there are documentation and manual documentation. The log file for VSFTPD is located in the/etc/logrotate.d/vsftpd.log directory.
VSFTPD software package Acquisition and installation