Setting up ftp servers in linux

Source: Internet
Author: User
Article Title: linux quick ftp Server SETUP. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

File Transfer Protocol (FTP) plays a very important role on the Internet. We can transmit and exchange file data with remote machines through FTP, and download or upload the latest software. The basic FTP server can be divided into two types based on the service objects. One is the basic FTP server of the Unix (including Linux) system. The user is a legal user on the server; the other is the anonymous FTP Server (Anonmous FTP Service). Anyone who uses anonmous or ftp account and provides an email address as a password can use the FTP Service.

For Valid users in the system, the logon directory is their home directory. If anonymous users log on, they will log on to the/home/ftp directory, unless we store the downloaded files in this directory, anonymous FTP users will not be able to do anything. In this chapter, we will introduce in detail the installation, configuration, and maintenance of the FTP server.

Install the FTP server

Both Linux releases contain the FTP server package wu-ftpd (Washington University FTP server), which is currently the most popular free FTP server software, currently, most FTP sites are set up by wu-ftpd, and wu-ftp is so popular because of its powerful functions, such:

· Control the FTP server access permissions and access time periods for machines in different domains.

· When downloading an object, you can automatically compress or decompress the object.

· Records the process of uploading or downloading files.

· You can limit the maximum number of visitors to maintain the optimal operating efficiency of the system.

· Displays relevant information so that you can understand the current receiving status.

· Temporarily shut down the FTP server for system maintenance.

If the wu-ftpd package is selected during system installation, the system will be automatically installed. However, if you want to use the latest FTP software package, you can download it from all major FTP sites around the world. The latest feature is wu-ftpd-2.5.. after wu-ftpd-2.5.0.tar.gz is reached, install it as follows.

1. Copy wu-ftpd-2.5.0.tar.gz to the temporary directory and decompress the package:

# Tar zxvf wu-ftpd-2.5.0.tar.gz

Go to the decompressed directory wu-ftpd-2.5.0, read the README, INSTALL and other files carefully before you start installation, in order to understand the precautions for installation.

2. Execute the command "bulid lnx" to compile the source program of the wu-ftpd-2.5.0.

#./Bulid lnx

This command will compile the service programs required for Linux to use wu-ftpd. If everything works properly, the following executable files will be generated:

Ftpd FTP service program

Ftpshut

Ftpcount shows the number of people currently connected to the FTP server

Ftpwho view current users

3. Run the "make install" command to install the compiled executable files and man pages to the system.

# Make install

4. Modify the/etc/inetd. conf file and add the following line:

Ftp stream tcp nowait root/usr/sbin/tcpd in. ftpd-l? A

If wu-ftpd is installed in the system, skip this step. The installation program automatically updates ftp records in the/etc/inetd. conf file.

5. If you want to provide FTP users with the compression and decompression function, you also need to copy executable files such as tar, gzip, compress, cpio, and sh to the/home/ftp/bin directory. In addition, you also need to copy the ls command to/home/ftp/bin for the user to view the directory.

Because the programs copied to the/home/ftp/bin directory may be dynamically linked, they also need to share the function library when running, we need to copy the shared libraries they need to run to the/home/frp/lib directory. You can use the "ldd" command to check the shared libraries required by these commands. For example, for the "ls" command, we can use the "ldd/usr/bin/ls" command to get the following output:

# Ldd/usr/bin/ls

Libc. so.6 =>/lib/libc. so.6 (0x40003000)

/Lib/ld-linux.so.2 =>/lib/ld-linux.so.2 (0x00000000)

In this way, we need to copy/lib/libc. so.6 and/lib/ld-linux.so.2 to the/home/ftp/lib directory. You can also find and copy the shared libraries required by other commands to the/home/etc/lib directory by referring to the above method.

Next, copy the/etc/passwd and/etc/group files to/home/ftp/etc, and delete the information of any individual users and user groups. Basically, you should follow the example below to modify it:

#/Home/ftp/etc/passwd file

Root: *: 0: 0 :::

Bin: *: 1: 1 :::

Operator: *: 11: 0 :::

Nobody: *: 99: 99 :::

Ftp: *: 1000: 1000 :::

#/Home/ftp/etc/group file

Root: 0:

Bin: 1:

Daemon: 2:

Sys: 3:

Adm: 4:

Ftp:: 1000:

6. To ensure that the provision of FTP services does not bring security risks to our system, we also need to take the following measures:

# Chmod 0555/home/ftp

# Chmod 0111/home/ftp/bin /*

# Chmod 0555/home/ftp/lib /*

# Chmid 0444/home/ftp/etc /*

Configure the FTP server

After wu-ftpd is installed, we also need to customize the FTP server to implement the various features we mentioned in the previous section. To enable our FTP server to implement these functions, we need to modify system configuration files such as ftpusers, ftpaccess, ftpconversions, xferlog, ftpgroups, and ftphosts. Next, let's take a look at the functions of these files and how to configure them.

Functions of configuration files

Before configuring the FTP server configuration file, let's briefly introduce the functions of each file. Under the doc/examples directory in the wu-ftpd-2.5.0 directory after the package is opened, we can find examples of these files.

/Etc/ftpaccess in general, the configuration file we pay the most attention to should be "ftpaccess", because this file determines whether the FTP server can work normally. In addition, you can set multiple permission records and file names and paths related to information in this system parameter file.

/Etc/ftpusers decides which users cannot execute ftp commands to transmit files. These accounts are usually root, bin, news, and guest accounts with special purposes.

You can configure/etc/ftpconversions to compress and package files while transferring files through FTP.

/Etc/ftphosts determines which hosts in the network or some users cannot access the files on the FTP server.

/Etc/ftpgroups this file does not determine which user groups cannot access the FTP server. It is only useful when using the site group function.

/Var/log/xferlog FTP log file. This file records the files uploaded or downloaded by users using anonymous accounts. This file only records FTP information and does not need to be configured.

After learning about the functions of various configuration files, we will introduce you to the content of these files and learn how to configure them.

[1] [2] [3] [4] [5] Next page

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.