Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the CentOS FTP server

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to configure the CentOS FTP server, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

1. Installation

Generally speaking, vsftd is installed automatically on CentOS. If it is not installed, you can install it using the following steps

Yum-y install vsftpd

Touch / var/log/vsftpd.log # create a log file for vsftp

In CentOS, this allows you to build a simple anonymous FTP. You can do this by visiting ftp://yourip, but this FTP does not have any permissions.

two。 Construction of FTP based on Anonymous

Refer to several articles on this blog about Vsftpd's CentOS FTP service configuration.

3. FTP erection based on Virtual user

The so-called virtual users do not use real accounts, but only achieve the purpose of mapping accounts and setting permissions by some means.

1) We configure the CentOS FTP service as follows in / etc/vsftpd/vsftpd.conf:

Anonymous_enable=NO setting does not allow anonymous access

Local_enable=YES sets local users to access. Note: if a virtual host user is used, all virtual users will not be able to access it if the project is set to NO.

Chroot_list_enable=YES prevents users from leaving the home directory

Xferlog_file=/var/log/vsftpd.log sets the service log save path for vsftpd. Note that the file does not exist by default. You have to touch it manually.

Ascii_upload_enable=YES

The ascii_download_enable=YES setting supports upload and download functions in ASCII mode.

Pam_service_name=vsftpd PAM certification file name. PAM will authenticate according to / etc/pam.d/vsftpd

The following are important CentOS FTP service configuration items supported by Vsftpd virtual users. These settings are not included in the default vsftpd.conf, so you need to manually add your own CentOS FTP service configuration.

The guest_enable=YES setting enables the virtual user feature.

Guest_username=ftp specifies the host user for the virtual user. -there are already built-in ftp users in CentOS

User_config_dir=/etc/vsftpd/vuser_conf sets the CentOS FTP service file storage path of the virtual user's personal vsftp. Store the CentOS FTP service file of the virtual user's personality (profile name = virtual user name)

2) create a chroot list and add the user ftp to it:

Touch / etc/vsftpd/chroot_list

Echo ftp > > / etc/vsftpd/chroot_list

3) carry out authentication:

First of all, to install the Berkeley DB tool, the problem for many people who can't find db_load is that the package is not installed.

Yum install db4 db4-utils

Then, create the user password text / etc/vsftpd/vuser_passwd.txt, and note that the odd line is the user name and the even line is the password

Ftpuser1

Ftppass1

Ftpuser2

Ftppass2

Then,. Generate db files 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

* to create a virtual user personality CentOS FTP service file

Mkdir / etc/vsftpd/vuser_conf/

Vi / etc/vsftpd/vuser_conf/ftpuser1

The contents are as follows:

The root directory of the local_root=/opt/var/ftp1 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 Could not create file

Generally speaking, there is a problem with SELinux. Set a value of 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 your CentOS FTP service file ensures that there are no spaces on each line, and the general error is on the extra space.

On how to configure the CentOS FTP server to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report