How to configure CentOSFTP service

Source: Internet
Author: User
I just configured vsftp on my VPS and encountered a lot of difficulties. I had to write a log to deepen my impression! 1. install and check whether vsftpd is installed. generally, vsftd is automatically installed on CentOS. if not, follow these steps to install vsftpd! Touch/var/log/vsft... I just configured vsftp on my VPS. I encountered a lot of difficulties and wrote a log to help me better understand it!
 
1. install
 
Check whether vsftpd is installed
 
 
 
Generally, vsftd is automatically installed on CentOS. if it is not installed, perform the following steps:
 
 
 
I have installed it!
 
Touch/var/log/vsftpd. log # Create a vsftp log file
In CentOS, you can build a simple anonymous FTP. You can access ftp: // yourip, but this FTP does not have any permissions.
 
2. Virtual User-based FTP setup
 
Virtual users do not use real accounts, but map accounts and set permissions by some means.
 
1) we configure the CentOS FTP service in/etc/vsftpd. conf:
Anonymous_enable = NO: Anonymous access is not allowed.
Local_enable = YES indicates that the local user can access it. 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 so that the user cannot leave the main directory
Xferlog_file =/var/log/vsftpd. log sets the path for saving service logs of vsftpd. Note: This file does not exist by default. Must be manually touch
Ascii_upload_enable = YES
Ascii_download_enable = YES: Supports the upload and download functions 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 CentOS FTP service configuration.
Guest_enable = YES sets to enable the virtual user function.
Guest_username = ftp specifies the host user of the virtual user. -CentOS already has built-in ftp users.
User_config_dir =/etc/vsftpd/vuser_conf set the path for storing the CentOS FTP service file of the virtual user's personal vsftp. CentOS FTP service file that stores Virtual User Personality (configuration file name = virtual user name)
 
2) create a chroot list and add the user ftp:
Touch/etc/vsftpd/chroot_list
Echo ftp>/etc/vsftpd/chroot_list
 
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
Ftppass1
Ftpuser2
Ftppass2
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 a CentOS FTP service file
 
------ The following part does not seem to work as set according to the online tutorial -------!
 
Mkdir/etc/vsftpd/vuser_conf/
Vi/etc/vsftpd/vuser_conf/ftpuser1
The content is as follows:
Local_root =/opt/var/ftp1 root directory of the virtual user (based on actual modification)
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
 
3. modify the FTP root directory
 
Vi/etc/passwd
 
The following content appears .... The red part is the default ftp root directory...
 
 
 
 
 
4. start the vsftp server
 
Mkdir/var/www/html/ftp
 
Chmod 755/var/www/html (an error occurs when html sets the 777 permission for the ftp main directory !)
 
Chmod 777/var/www/html/ftp
 
Service vsftpd start
 
TroubleShootings:
 
1.553 cocould not create file
This is generally a problem with SELinux. set a value for SELinux and restart the server.
Setsebool-P ftpd_disable_trans 1
Service vsftpd restart
 
2.500 OOPS: bad bool value in config file for: write_enable
Note that there is no space at the end of each line in your CentOS FTP service file. generally, an error is caused by extra spaces.

From yearnfar's blog
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.