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 vsftpd Virtual user in CentOS 6.2How to configure vsftpd Virtual user

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article shows you how to configure vsftpd virtual users in CentOS 6.2. the content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

The code is as follows:

[root@linuxde ~] # mount / dev/cdrom / media # Mount the image omitting the configuration of the YumSource

[root@linuxde ~] # yum install vsftpd # yum install vsftpd

[root@linuxde ~] # mv / etc/vsftpd/vsftpd.conf / etc/vsftpd/@vsftpd.conf.bak # back up the original configuration file for future reference and use

[root@linuxde ~] # vi / etc/vsftpd/vsftpd.conf # create vsftpd.conf

The contents are as follows:

The code is as follows:

Listen=YES

Background=YES

Anonymous_enable=NO

Local_enable=YES

Write_enable=YES

Local_umask=022

Anon_upload_enable=NO

Anon_mkdir_write_enable=NO

Dirmessage_enable=YES

Xferlog_enable=YES

Connect_from_port_20=YES

Chown_uploads=NO

Xferlog_file=/var/log/vsftpd.log

Xferlog_std_format=YES

Async_abor_enable=YES

Ascii_upload_enable=YES

Ascii_download_enable=YES

Ftpd_banner=Welcome to Nanu FTP server

Pam_service_name=vsftpd

Chroot_local_user=NO

Chroot_list_enable=YES

Chroot_list_file=/etc/vsftpd/vsftpd.chroot_list

Guest_enable=YES

Guest_username=linuxde

Nopriv_user=linuxde

User_config_dir=/etc/vsftpd/user_config

Max_clients=100

Max_per_ip=20

Create a chroot virtual user mapping file

The code is as follows:

[root@linuxde ~] # cat / etc/vsftpd/vsftpd.chroot_list

Linuxde # this file is created manually, and each line represents a name to map the virtual user to a local account to create a user account file

The code is as follows:

[root@linuxde ~] # cat / etc/vsftpd/passwd.file

Chenchen # this file does not exist by default, this file is used to store user accounts and clear text passwords, the format is two lines for each account, the first line is the user name, the second line is the password, and so on!

one hundred and twenty three

Passwords can be created using the strong password generation tool that comes with CentOS

The code is as follows:

[root@linuxde ~] # user name of mkpasswd parameter

-l defines the length of the generated password. Default is 9.

-d defines the number of numbers in the password. Default is 2.

-c definition contains the number of lowercase letters. Default is 2.

-C definition contains the number of uppercase letters. The default is 2.

-s definition contains the number of special characters. Default is 1.

-p specify another program to generate the password. The default is / etc/yppasswd.

Mkpasswd belongs to the expect RPM package, if it is not in the system, it can be installed through yum!

The code is as follows:

[root@linuxde ~] # yum install expect

Create user account compilation script

Vsfptd uses the DBD database for account authentication, so the user account file passwd.file needs to be compiled into DBD format.

The code is as follows:

[root@linuxde ~] # vi / etc/vsftpd/db_load.sh # create a script, or you don't have to create it, just use the command!

[root@linuxde ~] # cat / etc/vsftpd/db_load.sh

#! / bin/bash

# DBD convert for vsftpd passwd.file

Db_load-T-t hash-f / etc/vsftpd/passwd.file / etc/vsftpd/ftpuser_passwd.db

[root@linuxde ~] # chmod 755 / etc/vsftpd/db_load.sh # empower accordingly, compile the passwd.file account file and generate the ftpuser_passwd.db format file. Db_load belongs to the db4 RPM package. If not, please install it yourself.

[root@linuxde ~] # sh / etc/vsftpd/db_load.sh

[root@linuxde ~] # ll / etc/vsftpd/ftpuser_passwd.db

-rw-r--r--. 1 root root 12288 December 6 09:33 / etc/vsftpd/ftpuser_passwd.db

Create a user profile

After setting up an account, you need to create a configuration file for each user to record the location of the FTP directory, user permissions and other information.

The code is as follows:

[root@linuxde ~] # mkdir / etc/vsftpd/user_config

The configuration file takes the FTP user name as the file name, and each FTP user has one file, such as chenchen

The code is as follows:

[root@linuxde ~] # vi / etc/vsftpd/user_config/chenchen

The contents are as follows:

The code is as follows:

[root@linuxde ~] # cat / etc/vsftpd/user_config/chenchen

Local_root=/vsftptest/www.linuxde.net/ # the directory corresponding to this path must exist

Write_enable=YES

Anon_umask=022

Anon_world_readable_only=NO

Anon_upload_enable=YES

Anon_mkdir_write_enable=YES

Anon_other_write_enable=YES

Note: the system account to which the FTP user is mapped must have the appropriate read / write permissions to the FTP user home directory. Still take the chenchen user as an example. In this article, the chenchen virtual user is mapped to the linuxde system account, so the linuxde system account must have read / write access to chenchen's FTP home directory / vsftptest/www.linuxde.net/.

The code is as follows:

[root@linuxde] # chown-R linuxde:linuxde / vsftptest/www.linuxde.net/

Modify Pam authentication module

Back up vsftpd's original pam authentication module configuration file:

The code is as follows:

[root@linuxde ~] # mv / etc/pam.d/vsftpd / etc/pam.d/@vsftpd.bak # if you want to use the original configuration, the subsequent configuration parameters must be in the front row!

Write the new PAM authentication module configuration:

The code is as follows:

[root@linuxde ~] # cat / etc/pam.d/vsftpd # the suffix does not need to be .db here.

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

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

Start vsftpd

The code is as follows:

[root@linuxde ~] # service vsftpd start

The above is how to configure vsftpd virtual users in CentOS 6.2. have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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