Install and configure vsftp in centos

Source: Internet
Author: User

1. Install
Use chkconfig -- list to check whether the vsftpd service is installed;
Run the yum command to install: Yum-y install vsftpd.
Create a log file for it: Touch/var/log/vsftpd. Log

2. Create an FTP user and home directory:
# Mkdir/var/ftp
# Useradd-D/var/FTP

3. Configure the vsftp Service
Edit the/etc/vsftpd. conf file and configure the vsftp service:
# Vi/etc/vsftpd. conf
3.1 Edit and modify the following items:
Anonymous_enable = No # Set that anonymous access is not allowed
Local_enable = yes # Set the local user to access. Note: If a virtual host user is used, all virtual users cannot access the project if the project is set to No.
Chroot_list_enable = yes # prevents the user from leaving the main directory
Ascii_upload_enable = yes # Allow upload in ASCII mode
Ascii_download_enable = yes # sets the support for uploading and downloading in ASCII mode.
Pam_service_name = vsftpd # PAM Authentication file name. Pam will be authenticated according to/etc/PAM. d/vsftpd

The following are important centos FTP service configuration items for vsftpd virtual user support. By default, vsftpd. conf does not contain these configuration items. You must manually add the RHEL/centos FTP service configuration.
Guest_enable = yes # enable the virtual user function.
Guest_username = FTP # specifies the host user of the virtual user. -RHEL/centos already has built-in ftp users.
User_config_dir =/etc/vsftpd/vuser_conf # set the path for storing the RHEL/centos FTP service file of the virtual user's personal vsftp.

3.2 Create a chroot list and add FTP users to it:
Touch/etc/vsftpd/chroot_list
Echo ftp>/etc/vsftpd/chroot_list

3.3 perform authentication:
First, install the Berkeley dB tool. Many people cannot find db_load. The problem is that this package is not installed.
Yum install db4 db4-utils
Then, create the User Password text/etc/vsftpd/vuser_passwd.txt, note that the odd line is the user name, even the line is the password
Ftpuser1
123456
Ftpuser2
123456
Next, generate the database file for virtual user authentication
Db_load-T-t hash-F/etc/vsftpd/vuser_passwd.txt/etc/vsftpd/vuser_passwd.db
Then, edit the authentication file/etc/PAM. d/vsftpd and comment out all the original statements.
Add the following two sentences:
Auth required pam_userdb.so DB =/etc/vsftpd/vuser_passwd
Account required pam_userdb.so DB =/etc/vsftpd/vuser_passwd
Finally, create the RHEL/centos FTP service file
Mkdir/etc/vsftpd/vuser_conf/
VI/etc/vsftpd/vuser_conf/ftpuser1
The content is as follows:
Local_root =/var/FTP root directory of the virtual user (according to the actual modification, the/var/FTP directory is created in step 2)
Write_enable = Yes writable
Anon_umask = 022 mask
Anon_world_readable_only = No
Anon_upload_enable = Yes
Anon_mkdir_write_enable = Yes
Anon_other_write_enable = Yes

4. Restart the vsftp service:
Service vsftpd restart

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.