Vsftpd server construction in CentOS

Source: Internet
Author: User

Vsftpd server construction in CentOS

Vsftpd server construction in CentOS

1. The simplest vsftpd server Construction
1. Install vsftpd
1. Install yum

 yum install vsftpd 

2. Install the rpm file (if there is no rpm file, you can download it at http://rpmfind.net/)

rpm -ivh vsftpd-2.2.2-11.el6_4.1.x86_64.rpm

2. Firewall (centos 6.5 uses iptables firewall)
1. Open Port 21

1 iptables -A INPUT -p tcp --dport 21 -j ACCEPT

2. Open Port 20

1 iptables -A INPUT -p tcp --dport 20 -j ACCEPT

3. Open 20 active ports

1 iptables -A INPUT -m state --state NEW -p tcp --dport 20 -j ACCEPT

4. Open the active port 21

1 iptables -A INPUT -m state --state NEW -p tcp --dport 21 -j ACCEPT

5. Write the passive mode Port

12 echo pasv_min_port=30000 >> /etc/vsftpd/vsftpd.confecho_pasv_max_port=31000 >> /etc/vsftpd/vsftpd.conf

(Note: min and max can be entered at will, but follow the following rules:
Max> min & min> 1000 & max <65536)


6. Write the passive Port

1 iptables -A INPUT -p tcp --dport 30000:31000 -j ACCEPT

7. Save the Configuration

1 /etc/init.d/iptables iptables save

8. Restart the iptables firewall.

1 /etc/init.d/iptables iptables restart

3. Grant Permissions

1 chmod -R 755 /var/ftp

4. Test
Successful !!!

2. ftp Anonymous Server
1. Configuration
Under/etc/vsftpd. conf (this is the main configuration file of vsftpd:
Open the following configuration (delete the previous #. If not, you can add it by yourself. It is best not to comment out the default configuration file)
1234567891011121314151617181920212223242526272829303132 anonymous_enable=YES# Allow Anonymous Access local_enable=YES# Local real User Logon supported write_enable=YES# If you want to allow user upload local_umask=022# Restrict File Upload Permissions anon_upload_enable=YES# Allow File Upload anon_mkdir_write_enable=YES# Allow creating folders anon_other_write_enable=YES# You have read and write permissions on files, which means you can delete files. xferlog_enable=YES# Logging xferlog_file=/var/log/xferlog# Log location pam_service_name=vsftpd# Support for PAM module Management tcp_wrappers=YES# Firewall mechanism supporting TCP Wrappers

2. Test

Can be accessed and downloaded, but cannot be uploaded

3. selinux Configuration

View selinux:

1 getsebool -a | grep ftp

Set

1 setsebool -P allow_ftpd_anon_write=1 && setsebool -P allow_ftpd_full_access=1 &

The command execution is slow and can be executed in the background.

4. Test

Successful

3. Physical User Configuration
1. Configuration

1234567891011121314151617181920212223242526272829303132 anonymous_enable=no# Prohibit anonymous user access local_enable=yes# Real User Logon supported write_enable=yes# Write Permission local_umask=077# The default directory permission is 755. The default file permission is 644. dirmessage_enable=yes# Display file content connect_from_port_20=YES# Active connection xferlog_std_format=YES# Logging listen=YES# Start With stand alone pam_service_name=vsftpd# Support for pam module tcp_wrappers=yes# Tcp firewall supported userlist_enable=yes# Do not allow users in/etc/vsftpd/user_list to log on to vsftpd

2. selinux settings

1 setsebool -P ftp_home_dir=1

3. Test

Successful !!!


4. ftp server security
1. chroot
Directory:/etc/vsftpd/chroot_list

Usage:
1. Write the user names that need to be restricted into a row. It is best to write them through>.
2. Set vsftpd. conf
Chroot_list_user = YES
Chroot_list_enable = YES
Chroot_list_file =/etc/vsftpd/chroot
Purpose:
After the user name in the file is logged on to ftp, it can only be in the user's home directory

2. userlist
Directory:/etc/vsftpd/user_list

Usage:
1. Write the user names that need to be restricted into a row. It is best to write them through>.
2. Set vsftpd. conf
Userlist_enable = YES
Userlist_file =/etc/vsftpd/user_list

If [userlist_deny = NO]; then
In this case, users in the file can access ftp

In addition, [userlist_deny = YES]; then
In this case, users in the file cannot access ftp

Purpose:
Anyone who wants to use or not use ftp can

5. Summary

1. ftp uses 20 Ports, 21 of which 21 is the Channel port, and 20 is the connection port.

2. Firewall and selinux development rules

Four Advanced configurations of vsftpd Server:

VsFTPd configuration Tutorial:

Simple and practical Ubuntu FTP setup

Set up FTP server and Apache server on Ubuntu

Install the LAMP \ vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04

Simple case of anonymous uploading of SeLinux and vsftpd on the RHEL6 Platform

Install vsftpd source code in Linux

Install and configure the FTP server vsftpd in openSUSE 13.2/13.1

This article permanently updates the link address:

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.