Install and configure the FTP server in Linux

Source: Internet
Author: User
Tags ftp access

Install and configure the FTP server in Linux

Generally, code and files are uploaded to the server, and vsftp is used a lot. The following describes how to install the configuration.
Linux: centos6.6.
Installation Steps
1. Install vsftpd using yum

[root@localhost ~]# yum -y install vsftpd

2. Set to boot

[root@localhost ~]# chkconfig vsftpd on

3. Remove the following comments to make the configuration take effect:

Local_enable = YESwrite_enable = YESlocal_umask = 022chroot_local_user = YES # in this line, you may need to write pam_service_name = vsftpduserlist_enable = YES

4. After saving the configuration, restart the vsftpd service:

[root@localhost ~]# service vsftpd restart

Add users and additional configurations
1. Set the vsftp account.

[Root @ localhost ~] # Useradd-d/home/htdocs-s/sbin/nologin Username

2. Set a password for the added account

[Root @ localhost ~] # Passwd user name follow the prompts

In this case, the basic vsftpd service is configured. However, after the configuration is complete, the client cannot be connected. The main reason is that the CentOS firewall does not enable the ftp service under the default firewall settings, you must add a module and open port 21 to provide ftp access.
1. Add ip_conntrack_ftp Module

[root@localhost ~]# vi /etc/sysconfig/iptables-config

Add the following line

IPTABLES_MODULES="ip_conntrack_ftp"

2. Open Port 21

[root@localhost ~]# vi /etc/sysconfig/iptables

Add

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

3. Restart iptables to make the new rule take effect.

[root@localhost ~]# service iptables restart

At this point, it should be okay. If error 503 occurs during the software test connection, it should be a problem set by selinux: You can use the following command to check

[root@localhost ~]#getsebool -a |grep ftpallow_ftpd_anon_write --> offallow_ftpd_full_access --> offallow_ftpd_use_cifs --> offallow_ftpd_use_nfs --> offallow_tftp_anon_write --> offftp_home_dir --> offftpd_connect_db --> offftpd_disable_trans --> offftpd_is_daemon --> onhttpd_enable_ftp_server --> off

This is a problem with selinux. We only need to enable the value of ftp_home_dir to on:, and enable allow_ftpd_full_access.

[root@localhost ~]#setsebool -P ftp_home_dir 1[root@localhost ~]#setsebool -P allow_ftpd_full_access 1

At this point, the problem should be solved.

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.