In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail what is the use of vsftpd+mysql virtual users under Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Step one:
Install vsftpd
Apt-get install vsftpd (Debian is fun!)
The system automatically generates a configuration file and a ftp user for anonymous users. Vsftpd uses PAM to authenticate the virtual user. Because the virtual user's information is stored in the database, we also need a local user who can read the contents of the database, and we also need to set its local directory:
# mkdir / var/ftp
# useradd-d ftpguest / var/ftp
# chown ftpguest.nogroup / var/ftp
Step 2: install mysql
Apt-get install mysql-server mysql-clent
Set up the database and add users
# mysql-p mysql > create ftpu
Mysql > use ftpu
Mysql > create table user (name char (20) binary,passwd char (20) binary)
Mysql > insert into user (name,passwd) values ('test1',password (' 1234567'))
Mysql > insert into user (name,passwd) values ('test2',password (' 7654321'))
Mysql > quit
Enable ftpguest to access ftpu and table user:
# mysql-u root mysql-p mysql > grant select on ftpu.user to ftpguest@localhost identified by '123456'
Mysql > quit
Step 3: because vsftpd is verified by PAM, we also need a package with mysql verified by PAM, which is called libpam-mysql under Debian
Apt-get install libpam-mysql
Then open the PAM authentication for vsftpd:
# vi / etc/pam.d/vsftpd
Comment out the previous content, and then add the following:
Auth required pam_mysql.so user=ftpguest passwd=123456 host=localhost db=ftpu table=user usercolumn=name passwdcolumn=passwd crypt=2
Account required pam_mysql.so user=ftpguest passwd=123456 host=localhost db=ftpu table=user usercolumn=name passwdcolumn=passwd crypt=2
The above content should be able to understand it, that crypt=2 represents something that has been classified by mysql's password ()!
Step 4: modify the vsftpd.conf file
# vi / etc/vsftpd.conf
Join:
Uest_enable=YES
Guest_username=ftpguest
# indicates that ftpguest is a virtual user of vsftp
Virtual_use_local_privs=YES
# Virtual users have the same permissions as local users
Write_enable=YES
Anon_upload_enable=YES
Anon_other_write_enable=YES
# allow virtual users to upload, modify and delete files
Chroot_local_user=YES
# Virtual users can only access their own directories
Anonymous_enable=NO
Local_enable=YES
# disable anonymous user access and enable local user access
Step 5:
Originally, step 4 was completed, but then I thought, no, if the uploaded things are different each time, how to manage that directory in a mess? can we create a directory for each virtual user? for example, put the files uploaded by music users under ~ / music and the files uploaded by doc users under ~ / doc?
Yes! Of course I can. What can I do?
First, add two virtual users, music and doc, to the database, and then:
# mkdir / etc/vsftpd_user_conf
# cd / etc/vsftpd_user_conf
# touch music
# echo "local_root=/home/username/music" > music
# touch doc
# echo "local_root=/home/username/doc" > doc
# mkdir / home/username/music
# chown ftpguest.nogroup / home/username/music
# chmod 600 / home/username/music
# chown ftpguest.nogroup / home/username/doc
# chmod 600 / home/username/doc
Then add: user_config_dir=/etc/vsftpd_user_conf to the vsftpd.conf
This is the end of this article on "what is the use of vsftpd+mysql virtual users under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.