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 install and configure FTP server software VSFTP in CentOS

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "how to install and configure FTP server software VSFTP in CentOS". In daily operation, I believe many people have doubts about how to install and configure FTP server software VSFTP in CentOS. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "how to install and configure FTP server software VSFTP in CentOS". Next, please follow the editor to study!

Install VSFTP

The code is as follows:

Yum-y install vsftpd

Create FTP log file path

The code is as follows:

Touch / var/log/vsftpd.log

Startup configuration

The code is as follows:

Chkconfig-list vsftpd

Set 0:off 1:off 2:off 3:off 4:off 5:off 6:off manually if it is full off

The code is as follows:

Chkconfig-level 2345 vsftpd on

Start the ftp service:

The code is as follows:

Service vsftpd start

View the status of the ftp service:

The code is as follows:

Service vsftpd status

Restart the ftp service:

The code is as follows:

Service vsftpd restart

Shut down the ftp service:

The code is as follows:

Service vsftpd stop

Edit configuration file

The code is as follows:

Vi / etc/vsftpd/vsftpd.conf

The code is as follows:

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 # allows uploading in ASCII mode

Ascii_download_enable=YES # sets upload and download functions that support 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 RHEL/CentOS FTP service configuration.

The code is as follows:

Guest_enable=YES # sets the virtual user feature to be enabled.

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

User_config_dir=/etc/vsftpd/vuser_conf # sets the RHEL/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)

Create a chroot list to add ftp users to it:

The code is as follows:

Touch / etc/vsftpd/chroot_list

Echo ftp > > / etc/vsftpd/chroot_list

Install Berkeley DB tools

The code is as follows:

Yum install db4 db4-utils

Create user password text. Note that the odd line is the user name and the even line is the password.

The code is as follows:

Vi / etc/vsftpd/vuser_passwd.txt

Ftpuser1

Ftppass1

Ftpuser2

Ftppass2

Generate db files for virtual user authentication

The code is as follows:

Db_load-T-t hash-f / etc/vsftpd/vuser_passwd.txt / etc/vsftpd/vuser_passwd.db

Edit the certification file and comment out all configurations

The code is as follows:

Vi / etc/pam.d/vsftpd

Add the following two sentences

The code is as follows:

Auth required pam_userdb.so db=/etc/vsftpd/vuser_passwd

Account required pam_userdb.so db=/etc/vsftpd/vuser_passwd

Create a virtual user personality RHEL/CentOS FTP service file

The code is as follows:

Mkdir / etc/vsftpd/vuser_conf/

Vi / etc/vsftpd/vuser_conf/ftpuser1

The contents are as follows:

The code is as follows:

Root directory of 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

Open the firewall port

The code is as follows:

Vi / etc/sysconfig/iptables

Add a line, the default port 21 used by the port number

The code is as follows:

-An INPUT-p tcp-m state-- state NEW-m tcp-- dport 21-j ACCEPT

Attach permissions to the directory and restart the vsftp service:

The code is as follows:

Mkdir / opt/var/ftp/ftpuser1

Chmod 777 / opt/var/ftp/ftpuser1

Service vsftpd restart

At this point, the study on "how to install and configure FTP server software VSFTP in CentOS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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