How to implement an ftp vm in a Linux operating system

Source: Internet
Author: User
Article Title: how to implement an ftp vm in a Linux operating system. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded Systems, open source, and other basic categories virtual hosts use software technology to divide a server host running on the Internet into a virtual host with a relatively independent domain name and IP address, each "virtual" host has a complete Internet server (WWW, FTP, E-mail, etc.) function. Virtual Hosts are completely independent. in the outside world, each virtual host is exactly the same as an independent host. It solves the problem that it is too wasteful to install FTP servers on multiple machines in different domain network segments.
 
In Linux, we can use ftp service programs such as wu-FTP, tftp-server, proftpd, gssftp, and vsftp to build an FTP server. Wu-ftp (Washington University Ftp) is widely used in a variety of Linux releases and a variety of Unix (including ibm aix, FreeBSD, HP-UX, various BSD, Solaris, etc) at the same time, it occupies more than 50% of the internet, and now the Linux release version has 2.6 of wu-ftp, the following uses it as an example to describe how to implement an ftp vm in Linux.
 
  Virtual Host installation requirements
 
Wu-ftpd provides the VM function. It uses an FTP software to provide different FTP servers on the same host, and uses host names or IP addresses to differentiate different virtual hosts.
 
Wu-ftp has two installation methods: rpm and tar. Rpm installation is relatively simple. You can directly install it through rpm ivh wu-ftp *. rpm. The following describes how to install tar.
 
For Linux without RPM installation package, you can download a source tar code package from the http://www.wu-ftpd.org, so that you can better customize the various functions supported by wu-ftp as needed, it includes some additional upload speed, Vm, and other functions.
 
1. Unzip the package tar-zxvf wu-ftpd-current.tar.gz:
 
# Cd wu-ftp
 
2. Additional functions required for Configuration:
 
#./Configure -- enable-virtual
 
This enable-virtual parameter must be set. By setting this parameter, the service of the virtual host is provided, and the FTP server throughput is increased, in this way, wu-ftp has the VM function.
 
3. Compile and install
 
# Make
 
# Make install
 
After completing the preceding steps, the server has been successfully installed on the Linux system. Now the system should include
 
/Etc/ftpaccess
 
/Etc/ftpconversions
 
/Etc/ftpgroups
 
/Etc/ftphosts
 
/Etc/ftpusers
 
Configuration file and
 
/Usr/bin/ftpcount
 
/Usr/bin/ftpwho
 
/Usr/sbin/ftprestart
 
/Usr/sbin/ftpshut
 
Executable programs such as/usr/sbin/in. ftpd include some help and man documents. If these files are included in the system, the FTP server is successfully installed.
 
There are two files in these files about the virtual host configuration. The ftpservers file controls that when the customer logs on to different virtual hosts, the server uses different configuration files for function settings. For example, add the following two statements to ftpservers:
 
172.20.66.10/etc/ftpaccess.1
 
172.20.66.20/etc/ftpaccess.2
 
These two Parameters specify that when the user accesses from 10 IP addresses, the server specifies the ftpaccess.1 configuration file, and when the user accesses from 20 IP addresses, the server specifies the ftpaccess.2 configuration file. This file must be used with the configuration of the VM below.
 
   Configure a VM
 
1. bind multiple IP addresses to the host
 
The wu-ftp VM is based on the same host and different IP addresses. Therefore, you must configure multiple IP addresses on the same machine. One method is to bind multiple IP addresses to a network card.
 
If there is a network card on the machine and the network card is used to listen to FTP service requests, we can use the ifconfig command to implement this function.
 
# Ifconfig eth0: 0 172.20.66.2 up
 
# Ifconfig eth0: 1 172.20.66.3 up
 
We set two FTP virtual hosts, So we bind two IP addresses to the NIC. In Linux, a network card can theoretically bind 16 IP addresses. If you do not want to execute the command, you can change the configuration file in/etc/sysconfig/networking to achieve the same purpose.
 
2. Configure the ftpservers File
 
As mentioned above in the ftpservers file, the following configurations can be used in this example:
 
172.20.66.2/etc/ftpaccess1
 
172.20.66.3/etc/ftpaccess2
 
This file provides the path for storing the VM configuration file. When the client sends a request to the FTP server, the server searches for the IP Address requested by the client in this file, check whether a matching configuration file exists. If a matching configuration file exists, the configuration file in the directory corresponding to the IP address is called as the configuration file of the client. If no match is found, use the default configuration file. The IP address or host name can be used in this file. If the host name is used,/etc/hosts and DNS support are required to resolve the host name to the final IP address. this file is optional in the virtual host configuration. You do not need to set different configuration files for each virtual host, you can make some settings in the master ftpaccess file. We can implement the functions of the VM by configuring ftpaccess.
 
3. Configure the virtual host part in the ftpaccess File
 
The ftpaccess configuration file of the virtual server is added with multiple commands, such as virtia, root, and logfile, compared with the virtual server version, which are generated during source code compilation. The parameters are described below.
 
(1) virtual
 
Virtual
 
The above parameters set various basic configurations of the VM. the prefix of the virtual parameter indicates that the following parameters are set to set the VM; address specifies the IP address of the VM, the IP addresses are 172.20.66.2 and 172.20.66.3.
 
The following parameters are all subparameters created under virtual:
 
◆ Root specifies the ftp root directory of the VM;
 
◆ The banner specifies the system prompt information of the VM;
 
◆ Logfile specifies the location of the log file of the VM;
 
◆ Hostname specifies the Host Name of the VM;
 
◆ Email specifies the email address of the VM manager.
 
For example, the configuration of a virtual FTP server is specified in the following example:
 
# VM configuration settings
 
Virtual 172.20.66.2 root/var/ftp/virtual1
 
Virtual 172.20.66.2 banner/var/ftp/virtual/1.msg
 
Virtual 172.20.66.2 logfile/var/log/ftp/virtual/1 xferlog
 
Virtual 172.20.66.2 hostname 1
 
Virtual 172.20.66.2 email admin @ 1
 
Virtual 172.20.66.3 root/var/ftp/virtual
 
Virtual 172.20.66.3 banner/var/ftp/virtual/2.msg
 
Virtual 172.20.66.3 logfile/var/log/ftp/virtual/2 xferlog
 
Virtual 172.20.66.3 hostname 2
 
Virtual 172.20.66.3 email admin @ 2
 
(2) virtual
 
Allow [...]
 
Virtual
 
Deny […]
 
The above parameters set the virtual host permissions. Both allow and deny are virtual sub-parameters. They are used to set whether the virtual host can be accessed. Generally, the real and guest classes are the virtual hosts that users are not allowed to access. These two indicators are used to redefine the users who allow and deny access to the virtual hosts, these settings can be used with ftpuser to refine the server.
 
(3) defaultserver deny […]
 
Defaultserver allow [...]
 
Defaultserver private
 
The above parameters set the default value of access permissions in the virtual host. Note that they are not virtual subparameters. Where:
 
Defaultserver private specifies whether the default virtual server rejects access from the anonymous user.
 
Defaultserver deny specifies which users are denied access by the default virtual server.
 
Defaultserver allow specifies which users access the default virtual server.
 
Using the preceding configuration parameters and other FTP configuration files, a PC can be used as multiple FTP servers. Readers can customize their own ftp servers based on other wu-FTP configuration instructions.
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.