[Centos configuration 1] FTP Configuration

Source: Internet
Author: User

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

1. Install
Generally, vsftd is automatically installed on centos. If it is not installed, perform the following steps:
Yum-y install vsftpd
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. Anonymous FTP-based setup
Refer to the previous vsftpd configuration articles in this blog.
3. 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 following 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 configuration items for vsftpd virtual user support. By default, vsftpd. conf does not contain these configuration items. You need to manually add the 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 configuration file of the virtual user's personal vsftp. Configuration file for storing 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 virtual user profile configuration file
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
4. Start the vsftp Server
Mkdir/opt/var/FTP/ftpuser1
Chmod 777/opt/var/FTP/ftpuser1
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 configuration file. Generally, an error occurs when there are extra spaces.

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

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.