成都网站建设设计

将想法与焦点和您一起共享

Pureftpd和mysql如何架设FTP服务器

这篇文章主要介绍Pureftpd和MySQL如何架设FTP服务器,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都做网站、网站制作、岳普湖网络推广、微信小程序开发、岳普湖网络营销、岳普湖企业策划、岳普湖品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供岳普湖建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com

下载mysql5.1.31 rpm文件和pure-ftpd源码包

安装mysql5.1.31共享包

rpm -ivh MySQL-shared-community-5.1.31-0.rhel5.i386.rpm

编译安装pure-ftpd

#./configure –prefix=/usr/local/pureftpd –with-mysql –with-paranoidmsg –with-welcomemsg –with-uploadscript –with-cookie –with-virtualchroot –with-virtualhosts –with-virtualroot –with-diraliases –with-quotas –with-sysquotas –with-ratios –with-ftpwho –with-throttling   #make   #make check   #make install

配置pure-ftpd

#cd configuration-file   #chmod u+x pure-config.pl   #cp pure-config.pl /usr/local/sbin/   #cp pure-ftpd.conf /usr/local/etc/   vi /usr/local/etc/pure-ftpd.conf

确认以下三项

ChrootEveryone yes

MySQLConfigFile /etc/pureftpd-mysql.conf

CreateHomeDir yes

为puer-ftpd创建mysql数据库和用户

CREATE DATABASE pureftpd;

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO ‘pureftpd’@'localhost’ IDENTIFIED BY ‘password’;

FLUSH PRIVILEGES;

USE pureftpd;

CREATE TABLE ftpd (

User varchar(16) NOT NULL default ”,

status enum(’0′,’1′) NOT NULL default ’0′,

Password varchar(64) NOT NULL default ”,

Uid varchar(11) NOT NULL default ‘-1′,

Gid varchar(11) NOT NULL default ‘-1′,

Dir varchar(128) NOT NULL default ”,

ULBandwidth smallint(5) NOT NULL default ’0′,

DLBandwidth smallint(5) NOT NULL default ’0′,

comment tinytext NOT NULL,

ipaccess varchar(15) NOT NULL default ‘*’,

QuotaSize smallint(5) NOT NULL default ’0′,

QuotaFiles int(11) NOT NULL default 0,

PRIMARY KEY (User),

UNIQUE KEY User (User)

) TYPE=MyISAM;

配置pureftpd-mysql.conf

vi /etc/pureftpd-mysql.conf

录入

MYSQLSocket /tmp/mysql.sock

#MYSQLServer localhost

#MYSQLPort 3306

MYSQLUser pureftpd

MYSQLPassword password

MYSQLDatabase pureftpd

#MYSQLCrypt md5, cleartext, crypt() or password() – md5 is VERY RECOMMENDABLE uppon cleartext

MYSQLCrypt md5

MYSQLGetPW SELECT Password FROM ftpd WHERE User=”L” AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)

MYSQLGetUID SELECT Uid FROM ftpd WHERE User=”L” AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)

MYSQLGetGID SELECT Gid FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)

MYSQLGetDir SELECT Dir FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)

MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)

MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)

MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)

MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)

各参数注释

User:用户名

status:状态 1为激活状态 0为非激活状态

Password :密码

Uid:用户系统ID号

GID:用户组ID号

ULBandwidth :上传***带宽 单位 KB/S

DLBandwidth:下载***带宽 单位 KB/S

comment :注释

ipaccess :允许访问IP地址

QuotaSize :磁盘配额总大小 单位MB

QuotaFiles :允许存放的文件数目个数 0为不限制

关掉进程

killall pure-ftpd

启动服务

/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf

为ftp添加用户

USE pureftpd;

INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`, `ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`, `QuotaFiles`) VALUES (‘test’, ’1′, MD5(‘test’), ’60031′, ’60031′, ‘/home/test’, ’128′, ’56′, ”, ‘*’, ’100′, ’0′);

即可用数据库里的用户和密码登陆ftp

将pureftpd加载为系统服务

vi /etc/init.d/pureftpd

录入

#!/bin/bash   # chkconfig: 35 95 1   # description: script to start/stop pureftpd

case $1 in

start)

/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf

;;

stop)

killall pure-ftpd

;;

*)

echo “Usage: $0 (start|stop)”

;;

esac

更改权限

# chmod 775 pureftpd

加入自动启动

# chkconfig –add pureftpd

查看自动启动设置

# chkconfig –list pureftpd

pureftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off

以后可以用以下命令启动和停止脚本

# service pureftpd start 启动

# service pureftpd stop 停止

启动和停止mysql服务

#service mysql start

#service mysql stop

若无法上传文件,设置ftp文件夹权限

chmod -R 777 /data0/htdocs

以上是“Pureftpd和mysql如何架设FTP服务器”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


文章名称:Pureftpd和mysql如何架设FTP服务器
文章路径:http://chengdu.cdxwcx.cn/article/gsdjsg.html