proftpd+mysql安装配置
Author:gaojinbo
Time:2010-8-24
很多时候为了安全,不想在系统里面建立用户来使用ftp,这时候可以考虑使用proftpd+mysql来实现,用mysql管理用户。
根据本文的引导可以快速地建立ftp+mysql服务器
环境:
ubuntu 10.04.1 64bit
proftpd 1.3.2
mysql 5.1.41
1.安装proftpd
ubuntu上
apt-get install proftpd-basic proftpd-mod-mysql mysql-server
2.修改proftpd.conf配置文件
修改为:
ServerIdent on "Serv-U FTP"
ServerName "ftp.gaojinbo.com"
DefaultRoot ~
文件最后添加
RootLogin off
RequireValidShell off
LoadModule mod_sql.c
LoadModule mod_sql_mysql.c
AuthOrder mod_sql.c
SQLBackend mysql
SQLAuthTypes Backend
SQLAuthenticate users* groups*
SQLConnectInfo ftpuser@localhost root ylmf
SQLUserInfo ftp_users userid passwd uid gid homedir shell
SQLGroupInfo ftp_groups groupname gid members
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid=’%u’" ftp_users
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid=’%u’" ftp_users
3.添加用户www
useradd www
添加www用户用于ftp文件权限,uid和gid为1001
4.建立数据库
mysql -uroot -pgaojinbo
create database ftpuser default character set=utf-8;
use ftpuser
create table ftp_users(userid varchar(30),passwd varchar(50),uid int(10),gid int(10),homedir varchar(50),shell varchar(50));
insert into ftp_users values(‘gaojinbo’,password(‘gaojinbo’),’1001′,’1001′,’/var/ftp/virtual/gaojinbo.com’,'/bin/nologin’);
create table ftp_groups(groupname varchar(50),gid int(10),members varchar(250));
insert into ftp_groups values(‘ftpgroup’,’1′,’gaojinbo’);
建立用户主目录
mkdir -p /var/ftp/virtual/gaojinbo.com
5.启动proftpd并测试
/etc/init.d/proftpd start
or
proftpd –nd6
ftp localhost
用户gaojinbo,密码gaojinbo
完成!
五月 9th, 2011 at 20:40
Related Websites…
[...]some other related resources on the web that are worth viewing on this subject include[...]…
六月 3rd, 2011 at 02:49
Interesting Article…
[...]some interesting sites worth visitng. We recommend all our readers go and check these out[...]……