Install FTP under CentOS, set up firewall

Source: Internet
Author: User
Tags ftp login ssh iptables

Original link: http://www.centos.bz/2011/03/centos-install-vsftpd-ftp-server/


VSFTPD, as an FTP server, is very common in Linux systems. Here's how to install Vsftp on a centos system.

What is vsftpd

VSFTPD is one of the most admired FTP server programs in the Linux distribution. The feature is small and brisk, safe and easy to use.

VSFTPD's name stands for "Very secure FTP daemon", and security is one of the top issues considered by its developer Chris Evans. At the beginning of the design and development of this FTP server, high security is a goal. Install VSFTPD

1. Execute the following command as Administrator (root) yum install vsftpd

2, set up boot vsftpd FTP service chkconfig vsftpd on

3, Start vsftpd service vsftpd start

Manage VSFTPD related commands:

Stops Vsftpd:service vsftpd stop

Reboot Vsftpd:service vsftpd Restart Configure firewall

Open/etc/sysconfig/iptables File Vi/etc/sysconfig/iptables

(If you find no iptables this file:

Workaround:

1, casually write a iptables command to configure a firewall rule: such as:

Iptables-p OUTPUT ACCEPT

2, service iptables save for saving)

Add the following code before the Reject line-A rh-firewall-1-input-m State--state new-m tcp-p TCP--dport 21-j ACCEPT

Save and close files, reboot Firewall service iptables start Configure VSFTPD server

The default configuration file is/etc/vsftpd/vsftpd.conf, which you can open with a text editor. vi/etc/vsftpd/vsftpd.conf Add FTP users

The following is the add Ftpuser user, set the root as/home/wwwroot/ftpuser, prohibit this user from logging on to SSH, and restrict access to other directories.

1. Modify/etc/vsftpd/vsftpd.conf

The bottom three lines #chroot_list_enable =yes # (default follows) #chroot_list_file =/etc/vsftpd.chroot_list

Change to Chroot_list_enable=yes # (default follows) Chroot_list_file=/etc/vsftpd/chroot_list

3, increase user Ftpuser, point to directory/home/wwwroot/ftpuser, prohibit login SSH permission. useradd-d/home/wwwroot/ftpuser-g ftp-s/sbin/nologin ftpuser

4, set user password passwd ftpuser

5. Edit file chroot_list: vi/etc/vsftpd/chroot_list

Content is an FTP user name, one row for each user, such as:

Peter
John

6, restart VSFTPD service vsftpd restart

In addition, if you find it troublesome to manage your FTP username later, you can use the CentOS official release script management. The address is as follows:

the error that occurred in Http://wiki.centos.org/HowTos/Chroot_Vsftpd_with_non-system_users

1 Oops:cannot Change Directory
Workaround:

In the terminal input command: setsebool-p Ftpd_disable_trans 1 service vsftpd restart

It's OK.
Reason: This is because the server has SELinux enabled, which limits the ftp login.

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.