RHEL6.4 build an FTP server

Source: Internet
Author: User
Lab requirements: Set up an ftp server under RHEL6.4 to prohibit anonymous user logon, allow a local account to log on and block normal accounts. Set normal account logon access/data/ftp in your home directory to limit the download speed of normal accounts to KB/s ---------------------------------- split line quota ----------------------------------------------

Lab requirements:

Build an ftp server under RHEL6.4

Prohibit anonymous user logon and allow local account logon

Ban normal accounts in your home directory

Set normal account login access/data/ftp

Limit normal account download speed by kb/s

---------------------------------------------- Split line ----------------------------------------------

Recommended reading:

Four Advanced configurations for vsftpd servers: http://www.linuxidc.com/Linux/2013-09/90565.htm

VsFTPd configuration Tutorial: http://www.linuxidc.com/Linux/2013-09/90562.htm

Ubuntu practical and simple FTP erection http://www.linuxidc.com/Linux/2012-02/55346.htm

Set up FTP server and Apache server http://www.linuxidc.com/Linux/2011-04/35295.htm on Ubuntu

Install LAMP \ vsftpd \ Webmin \ phpMyAdmin service and set http://www.linuxidc.com/Linux/2013-06/86250.htm in Ubuntu 13.04

Simple case http://www.linuxidc.com/Linux/2013-04/82300.htm for anonymous uploading of SeLinux and vsftpd on RHEL6 Platform

Linux vsftpd source code installation http://www.linuxidc.com/Linux/2013-03/81475.htm

Case study of vsftpd Security Configuration http://www.linuxidc.com/Linux/2012-12/76501.htm

---------------------------------------------- Split line ----------------------------------------------


1. install the software package on the server (192.168.100.1)

[Root @ ftp-server ~] # Rpm-q vsftpd

Vsftpd-2.2.2-11.el6.x86_64

 


2. Modify the master configuration file

[Root @ ftp-server ~] # Vim/etc/vsftpd

12 anonymous_enable = NO // disable anonymous user logon

......

120 chroot_local_user = YES // block a normal account in its home directory

121 local_root =/data/ftp // set the home directory/data/ftp

122 local_max_rate = 150000 // limit normal account download speed by kb/s

 


3. Create a home directory and an entity test account

[Root @ ftp-server ~] # Useradd obama

[Root @ ftp-server ~] # Echo "123456" | passwd -- stdin obama

[Root @ ftp-server ~] # Mkdir-p/data/ftp

[Root @ ftp-server ~] # Ls-ld/data/ftp

Drwxr-xr-x. 2 root 4096 Apr 16/data/ftp // entity account cannot be uploaded

[Root @ ftp-server ~] # Dd if =/dev/zero of =/data/ftp/film. avi bs = 1 M count = 512 // create a test file

 


4. Start the service

[Root @ ftp-server ~] # Service vsftpd start

[Root @ ftp-server ~] # Chkconfig vsftpd on

 


5. Client Test

[Root @ client ~] # Ftp 192.168.100.1 // you can also use graphical software for testing. If the ftp command is not available, install the software package yum install ftp first.

Connected to 192.168.100.2 (192.168.100.1 ).

220 (vsFTPd 2.2.2)

Name (192.168.100.2: root): obama

331 Please specify the password.

Password:

500 OOPS: cannot change directory:/home/obama // This prompt describes selinux Problems

Login failed.

 


6. Modify selinux settings of the server

[Root @ ftp-server ~] # Getsebool-a | grep ftp // find the ftp-related Boolean Value

Allow_ftpd_anon_write --> off

Allow_ftpd_full_access --> off

Allow_ftpd_use_cifs --> off

Allow_ftpd_use_nfs --> off

Ftp_home_dir --> off

Ftpd_connect_db --> off

Ftpd_use_passive_mode --> off

Httpd_enable_ftp_server --> off

Tftp_anon_write --> off

 


[Root @ ftp-server ~] # Setsebool-P ftp_home_dir = 1 // set this option to enable

 


7. test again on the client

[Root @ client ~] # Ftp 192.168.100.1

Connected to 192.168.100.1 (192.168.100.1 ).

220 (vsFTPd 2.2.2)

Name (192.168.100.2: root): obama

331 Please specify the password.

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp> ls

227 Entering Passive Mode (192,168,100, 2,123,195 ).

150 Here comes the directory listing.

-Rw-r -- 1 0 0 536870912 Apr 16 12:38 film. avi

226 Directory send OK.

 


[Root @ client ~] # Wget ftp: // obama: 123456@192.168.100.2/film. avi // test download speed

 

For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-05/101166.htm

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.