Ubuntu 配置 vsftp+mysql - XiZi's Blog

Ubuntu 配置 vsftp+mysql

Xizi posted @ 2009年5月06日 23:20 in Ubuntu with tags ubuntu vsftpd vsftp mysql , 2857 阅读

1、安装vsftpd

sudo apt-get install vsftpd

 2、安装pam的mysql验证模块"pam_mysql.so"

sudo apt-get install libpam-mysql

3、配置vsftpd的PAM验证文件

vim /etc/pam.d/vsftpd

   Here is an example,注释掉原有的,添加最下面两行 

# Standard behaviour for ftpd(8).
# auth  required        pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed

# Note: vsftpd handles anonymous logins on its own.  Do not enable
# pam_ftp.so.

# Standard blurb.
#@include common-session

#@include common-auth
#auth   required        pam_shells.so

auth required pam_mysql.so user=yoursqluser passwd= host=localhost db=vsftpd table=user usercolumn=name passwdcolumn=passwd crypt=0 sqllog=1 logtable=log logmsgcolumn=msg logusercolumn=user logpidcolumn=pid loghostcolumn=host logtimecolumn=time verbose=1
account required pam_mysql.so user=yoursqluser  passwd=p@ssw0rd  host=localhost db=vsftpd table=user  usercolumn=name passwdcolumn=passwd crypt=0 sqllog=1 logtable=log logmsgcolumn=msg logusercolumn=user logpidcolumn=pid loghostcolumn=host logtimecolumn=time verbose=1
p@ssw0rd

#红色部分请根据自己的实际情况修改

4、修改vsftpd的配置文件

vim vim /etc/vsftpd.conf

Here is an example,开启了ipv6的监听。 

#去掉了所有的注释行
# listen=YES 这里注释掉是因为此项与listen_ipv6只能选一项,开启ipv6后自动侦听ipv4
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
guest_enable=YES
guest_username=ftp
anon_world_readable_only=NO
virtual_use_local_privs=YES
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
 

 5、确定你对ftp目录的写权限

sudo chown -R ftp\: /home/ftp/

6、最后重启vsftpd服务,看看服务器好没好用?

sudo /etc/init.d/vsftpd restart

好了,可以看看你的服务器是不是好了?

root@www:/home# ftp localhost
Connected to localhost.
220 (vsFTPd 2.0.7)
Name (localhost:ado): admin
331 Please specify the password.
Password:       //这里输入密码但看不见
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r--    1 109      1001           76 May 07 02:07 2.txt
drwxr-xr-x    2 109      1001         4096 May 07 01:10 a directory
-rwxr-xr-x    1 109      1001         1482 May 07 02:07 bridge
drwxr-xr-x    3 109      1001         4096 May 07 02:07 icc32
-rwx------    1 109      1001     78771302 May 07 02:08 l_fc_p_10.1.015.tar.gz
-rw-r--r--    1 109      1001          323 May 07 01:36 ls.txt
226 Directory send OK.
ftp> mkdir test
257 "/test" created
ftp> rm test
250 Remove directory operation successful.
ftp>exit
root@www:/home#

 

 P.S.

   mysql 数据库的建立

#创建管理vsftpd用户的数据库和表,并插入测试帐号
#mysql -u root -p123456
CREATE DATABASE ftp;
USE ftp;
CREATE TABLE user(name CHAR(20) BINARY,passwd CHAR(20) BINARY);
INSERT INTO user (name,passwd) VALUES ('test1','12345');
INSERT INTO user (name,passwd) VALUES ('test2','54321');
GRANT SELECT on ftp.user to ftp@localhost identified BY '123456';
flush PRIVILEGES;
quit
 

 配置过程参考:菜鸟ubuntu8.04桌面版配置vsftp+mysql+pam 无法使用Ubuntu 8.04 Desktop上的vsftp+mysql+pam_mysql

 

Avatar_small
mini porco comprar 说:
2021年6月04日 00:43

I must admit that your post is really interesting. I have spent a lot of my spare time reading your content. Thank you a lot!

Avatar_small
CPI 说:
2021年6月07日 04:27

Super site! I am Loving it!! Will return once more, Im taking your food likewise, Thanks.

Avatar_small
how to buy pentobarb 说:
2021年6月12日 23:07

I think it could be more general if you get a football sports activity

Avatar_small
Dairy Farm Residence 说:
2021年6月22日 23:36

There are also commercial shops in the condominium comprising of shops, supermarket, food court, child care centre.

Avatar_small
Irwell hill residenc 说:
2021年6月23日 03:34

Sitting on a land of approximate 138,000sft , Irwell Hill Residences comprise of 2 tower of 36-storey high tower with a total of 540-units ranging from studio, 1-bedroom to 4-Bedroom and Penthouses.

Avatar_small
how to track a phone 说:
2021年6月27日 03:43

I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one

Avatar_small
Cheap Instagram foll 说:
2021年7月10日 23:47

This is also a very good post which I really enjoy reading. It is not everyday that I have the possibility to see something like this.

Avatar_small
cheap smm panel 说:
2021年7月24日 02:37

I was taking a gander at some of your posts on this site and I consider this site is truly informational! Keep setting up..

Avatar_small
Buy clubhouse follow 说:
2021年8月03日 23:26

This is an awesome motivating article.I am practically satisfied with your great work.You put truly extremely supportive data. Keep it up. Continue blogging. Hoping to perusing your next post

Avatar_small
sea-doo-gtx-limited3 说:
2021年8月07日 21:48

A debt of gratitude is in order for the blog entry amigo! Keep them coming...

Avatar_small
Marriage Counselling 说:
2021年8月21日 22:57

Hi! This is my first visit to your blog! We are a team of volunteers and new initiatives in the same niche. Blog gave us useful information to work. You have done an amazing job!

Avatar_small
practice karambit 说:
2021年8月22日 00:31

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!

Avatar_small
ร้านอาหารอุบล 说:
2021年11月30日 06:32

I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read!! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site.

Avatar_small
โรงงานสบู่ 说:
2021年12月02日 05:10

I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read!! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site.

Avatar_small
DHSE +1 Exam Pattern 说:
2022年7月02日 00:26

The DHSE Kerala Class 11 Blueprint 2023 will be made public by the Kerala Board in order to aid students in better exam preparation. The release date for the DHSE Kerala 11th Online Marking Scheme in 2023 is. The 11th Class DHSE Kerala Weightage Marks 2023 will Aid Students in Understanding Exam Pattern, 2023 Marking Scheme, and Important Topics. Exams for the DHSE Kerala 11th Board were planned to start in February and end in March. DHSE +1 Exam Pattern 2023 However, until further notice, the exams have been postponed. Because of this, now is the ideal time for students to complete the most recent blueprint and exam pattern (2023) and complete the DHSE Kerala 11th Question Bank. They will benefit in many ways from solving the same and be able to do well on exams.

Avatar_small
charlly 说:
2023年1月10日 20:00

When it comes to Ubuntu deployment, there are a few options available. One popular option is to use vsftp+mysql. This option offers a great deal of flexibility and can be easily customized to meet your specific needs. Additionally, diamond rings this option is relatively easy to set up and use.

Avatar_small
EPF Grievance 说:
2023年1月31日 15:22

The EPF account holder receives a unique number once the complaint is registered on the EPFiGMS portal. This number makes it possible to track the complaint's status at any time after registration, EPF Grievance and every complaint entered into the system is subject to strict daily monitoring as well as the necessary manual supervision on a regular basis. To proceed with the process and choose the appropriate category for his complaint, an EPFO member must have a UAN number.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee