Enable FTP and user configuration for centos

Source: Internet
Author: User
Tags ssh access

As an FTP server, vsftpd is very common in Linux systems. The following describes how to install vsftp on centos.

 

What is vsftpd?

Vsftpd is the most popular FTP server program in the Linux release. Features: small, light, secure, and easy to use.

The name of vsftpd stands for "very secure FTP daemon". Security is one of the top concerns of Chris Evans, its developer. At the beginning of the FTP server design and development, high security is a goal.

Install vsftpd

1. Run the following command as the administrator (Root ):

  1. Yum install vsftpd

2. Set vsftpd FTP service to start upon startup

  1. Chkconfig vsftpd on

3. Start the vsftpd service

  1. Service vsftpd start

Manage vsftpd commands:

Stop vsftpd: Service vsftpd stop

Restart vsftpd: Service vsftpd restart

Configure Firewall

Open the/etc/sysconfig/iptables File

  1. VI/etc/sysconfig/iptables

Add the following code before the reject line

  1. -A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 21-J accept

Save and close files and restart Firewall

  1. Service iptables start
Configure the vsftpd Server

The default configuration file is/etc/vsftpd. conf. You can open it in a text editor.

  1. VI/etc/vsftpd. conf
Add an FTP user

Add the ftpuser user and set the root directory to/home/wwwroot/ftpuser. Disable the user from logging on to SSH and restrict access to other directories.

1. Modify/etc/vsftpd. conf.

Set the following three lines

  1. # Chroot_list_enable = Yes
  2. # (Default follows)
  3. # Chroot_list_file =/etc/vsftpd. chroot_list

Change

  1. Chroot_list_enable = Yes
  2. # (Default follows)
  3. Chroot_list_file =/etc/vsftpd/chroot_list

3. Add the user ftpuser and point to the/home/wwwroot/ftpuser directory. disable SSH access.

  1. Useradd-D/home/wwwroot/ftpuser-g ftp-S/sbin/nologin ftpuser

4. Set the User Password

  1. Passwd ftpuser

5. edit the file chroot_list:

  1. VI/etc/vsftpd/chroot_list

The content is the FTP user name, and each user occupies one line, for example:

User11

6. Restart vsftpd.

  1. Service vsftpd restart

In addition, you can use scripts officially released by centos to manage FTP usernames in the future. The address is as follows:

Http://wiki.centos.org/HowTos/Chroot_Vsftpd_with_non-system_users

7. Pay attention to user permission Configuration

Chmod 755/home/wwwroot/ftpuser

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.