Set up an FTP server in Linux (1)

Source: Internet
Author: User
Tags ftp access
Article Title: Setting up an FTP server in Linux (1 ). 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.
Overview
Using the file transfer protocol (FTP) to transfer files between computers over the network is a common method. Almost all platforms have FTP client and server software. Therefore, it is very convenient to use FTP to transfer files.
There are many different methods to configure the FTP server. One of them is to configure FTP as a private server only available to users in the system, which is also the default configuration of FTP. A private FTP server runs only the access from users in the system, and can control the access to users, so as to grant or deny access permissions to specific users.
Configure the FTP server as an anonymous server. The anonymous FTP server allows anyone (regardless of their account) to access the server and transfer files. Because there may be potential security problems, you must be careful with the configuration so that you can only access specific directories in the system. In this section, we Configure FTP to "chrooted". This configuration runs user access, for example, the Directory of the Web site, but does not allow them to access the directory at a higher level.
Notes
All the following commands are Unix-compatible commands.
The Source Path is "/var/tmp" (other paths can also be used in actual situations ).
Installed in RedHat Linux 6.1 and passed the test.
Use the "root" user for installation.
The wu-ftp Version is 2.6.0.
Compile and install
Decompress the software package (tar.gz:
[Root @ deep] # cp wu-ftpd-version.tar.gz/var/tmp
[Root @ deep] # cd/var/tmp
[Root @ deep] # tar xzpf wu-ftpd-version.tar.gz
Compilation and Optimization
Go to the new directory of wu-ftpd and run the following command:
Edit the "ftpcount. c" file (vi + 241 src/ftpcount. c) and change the following line:
# If defined (LINUX)
Changed:
# If defined (LINUX_BUT_NOT_REDHAT_6_0)
Edit the "pathnames. h. in" file (vi + 42 src/pathnames. h. in) and change the following line:
# Define _ PATH_EXECPATH "/bin/ftp-exec"
Changed:
# Define _ PATH_EXECPATH "/usr/bin/ftp-exec"
Change "ftp-exec" from the "/bin" directory to the "/usr/bin" directory.
First, set the compilation parameters of the compiler:
CC = "egcs"
CFLAGS = "-O9-funroll-loops-ffast-math-malign-double-mcpu = pentiumpro-march = pentiumpro-fomit-frame-
Pointer-fno-exceptions"
./Configure
-- Prefix =/usr
-- Sysconfdir =/etc
-- Localstatedir =/var
-- Disable-dnsretry
-- Enable-quota
-- Enable-pam
-- Disable-daemon
-- Disable-newlines
-- Disable-virtual
-- Disable-plsm
-- Disable-pasvip
-- Disable-anonymous
-- Enable-ls
-- Enable-numericuid
These compilation parameters tell the compiler how to compile wu-ftpd:
Do not use failed DNS queries
Added support for the QUOTA (QUOTA) (if OS supports)
Added support for PAM
It cannot be run as a separate daemon.
Delete too many empty rows
Virtual servers are not supported
Disable PID locking for sleep messages (for busy sites)
The same IP address is not required for passive connection.
Anonymous ftp access not allowed
Use the internal "ls" command (experimental)
The internal "ls" command displays UID instead of user name (to speed up)
Use the following command to compile and install the software:
Make
Make install
Install-m 755 util/xferstats/usr/sbin
Touch/var/log/xferlog
Chmod 600/var/log/xferlog
Cd/usr/sbin
Ln-sf in. ftpd/usr/sbin/wu. ftpd
Ln-sf in. ftpd/usr/sbin/in. wuftpd
Strip/usr/bin/ftpcount
Strip/usr/bin/ftpwho
Strip/usr/sbin/in. ftpd
Strip/usr/sbin/ftpshut
Strip/usr/sbin/ckconfig
Strip/usr/sbin/ftprestart
The above "make" and "make install" can be used to configure software to ensure that there is a library required for compilation in the system, and then compile all the source files into executable binary files, finally, install the binary and configuration files in the corresponding directory.
"Install? M "installs the" xferstats "program to count how many files are transferred. The "touch" command creates a log file in the "/var/log" directory for xferstats. "Chomod" changed the "xferlog" permission to be readable and writable only to the Super User "root. Next, we create a symbolic link for the "in. ftpd" binary file. Finally, run the strip command to reduce the size of all binary files to Improve the Performance of wu-ftpd.
Clear unnecessary files
[Root @ deep] # cd/var/tmp
[Root @ depth] # rm-rf wu-ftpd-version/wu-ftpd-version.tar.gz
The "rm" command deletes all source programs required to compile and install wu-ftpd, and deletes the compressed package of the wu-ftpd software.
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.