博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos 6.8 安装 pure-ftpd-1.0.43,采用MariaDB作为用户数据库
阅读量:5831 次
发布时间:2019-06-18

本文共 5629 字,大约阅读时间需要 18 分钟。

hot3.png

内容有点乱,回头有空再整理

Pure-Ftpd 采用 MariaDB 数据库,确保下面几项都已安装

yum -y install MariaDB-client MariaDB-server MariaDB-devel

下载并解压pure-ftpd包

进入pure-ftp目录,执行

./configure --prefix=/usr/local/pureftpd --with-cookie --with-throttling --with-ratios --with-quotas --with-sysquotas --with-largefile --with-welcomemsg --with-uploadscript --with-virtualhosts --with-virtualroot --with-virtualchroot --with-diraliases --with-peruserlimits --with-language=simplified-chinese --with-mysql --with-paranoidmsg --with-altlogmake && make install

配置

准备文件

cd configuration-filecp pure-config.pl /usr/local/pureftpd/bin/.chmod 755 /usr/local/pureftpd/bin/pure-config.plmkdir /usr/local/pureftpd/etc              //新建FTP的配置文件夹目录cp pure-ftpd.conf /usr/local/pureftpd/etc/.   //复制ftp配置文件到etc中cd ..     //切换到/pure-ftpd-1.0.22目录中cp pureftpd-ldap.conf /usr/local/pureftpd/etc/.      //相关配置文件复制到etc中cp pureftpd-mysql.conf /usr/local/pureftpd/etc/.  //相关配置文件复制到etc中cp pureftpd-pgsql.conf /usr/local/pureftpd/etc/.    //相关配置文件复制到etc中

pure-ftpd.conf配置

vi /usr/local/pureftpd/etc/pureftpd-mysql.conf
MYSQLSocket      /tmp/mysql.sock#MYSQLServer     localhost#MYSQLPort       3306MYSQLUser       pureftpdMYSQLPassword   这里输入前面给mysql授权时的密码MYSQLDatabase   pureftpd#MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMMENDABLE uppon cleartextMYSQLCrypt      md5MYSQLGetPW          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")

pure-ftpd.conf配置

vi /usr/local/pureftpd/etc/pure-ftpd.conf
ChrootEveryone    yesMySQLConfigFile    /usr/local/pureftpd/etc/pureftpd-mysql.confCreateHomeDir    yes

创建组和用户以及mysql表创建

# groupadd ftpgroup –g 1000# useradd ftpuser –g ftpgroup –u 1000 –d /data/ftp –s /sbin/nologin
CREATE DATABASE pureftpd;GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY '对应的密码';GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost.localdomain' IDENTIFIED BY '对应的密码';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;
数据表说明:User:帐号名;status:0 表示帐号被禁用,无法登录服务器;Password:密码,使用MD5加密;Uid:前面创建的ftpuser帐户号,我们填写的是2001;Gid:前面创建的ftpgroup组号,我们填写的是2001;Dir:虚拟用户的个人目录路径,将在/home下创建(第一次登录);ULBandwidth:上传文件限制速度,KB/s,0为不限制;DLBandwidth:下载文件限制速度,KB/s,0为不限制;comment:备注信息;ipaccess:* 表示任意IP都可以访问此ftp服务器,输入具体IP地址可以只允许此IP连接服务器;QuotaSize:用户磁盘空间分配,单位:MB,0表示不加限制;QuotaFiles:用户可以保存的文件数量限制,0表示不加限制。

添加pureftpd为系统服务

vi /etc/init.d/pureftpd
#!/bin/sh## ScriptName: /etc/init.d/pureftpd# chkconfig: - 60 50# description: pureftpd is a ftp daemon, which is the program \# that answers incoming ftp service requests.# processname: pureftpd## Author : cnscn# Time : 2006-04-18 09:30##tput funcfuncTput(){tput initfor argsdocase "$args" ingreen_black)echo -e -n "\033[;32m";;red_black)echo -e -n "\033[;31m";;endtput)tput sgr0esacdone}case "$1" instart)ps aux | grep pure-ftp | grep -v grep > /dev/null 2>&1if [ $? -eq 0 ]thenecho -n "Pureftpd has already been running ... "funcTput red_blackecho "[failed]"funcTput endtputexit 1fiecho -n "start pureftpd.... "/usr/local/pureftpd/bin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf > /dev/null 2>&1if [ $? -eq 0 ] ; thenfuncTput green_blackecho " [OK]"funcTput endtputelsefuncTput red_blackecho " [Failed] ";funcTput endtputfi;;stop)ps aux | grep pure-ftp | grep -v grep > /dev/null 2>&1if [ $? -eq 1 ]thenecho -n "Pureftpd has not been runned now ... "funcTput red_blackecho "[failed]"funcTput endtputexit 1fiecho -n "Stop pureftpd... "killall pure-ftpd > /dev/null 2>&1if [ $? -eq 0 ] ; thenfuncTput green_blackecho " [OK]"funcTput endtputelsefuncTput red_blackecho " [Failed] ";funcTput endtputfi;;restart)ps aux | grep pure-ftp | grep -v grep > /dev/null 2>&1if [ $? -eq 0 ]thenecho -n "Stop pureftpd... "killall pure-ftpd > /dev/null 2>&1if [ $? -eq 0 ] ; thenfuncTput green_blackecho " [OK]"funcTput endtputelsefuncTput red_blackecho " [Failed] ";funcTput endtputfifiecho -n "start pureftpd.... "/usr/local/pureftpd/bin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf >/dev/null 2>&1if [ $? -eq 0 ] ; thenfuncTput green_blackecho " [OK]"funcTput endtputelsefuncTput red_blackecho " [Failed] ";funcTput endtputfi;;*)echo "Usage: `basename $0` {start | stop | restart}";;esacexit 0

参考:

转载于:https://my.oschina.net/u/1476134/blog/777698

你可能感兴趣的文章
Using RequireJS in AngularJS Applications
查看>>
hdu 2444(二分图最大匹配)
查看>>
【SAP HANA】关于SAP HANA中带层次结构的计算视图Cacultation View创建、激活状况下在系统中生成对象的研究...
查看>>
DevOps 前世今生 | mPaaS 线上直播 CodeHub #1 回顾
查看>>
iOS 解决UITabelView刷新闪动
查看>>
CentOS 7 装vim遇到的问题和解决方法
查看>>
JavaScript基础教程1-20160612
查看>>
【ros】Create a ROS package:package dependencies报错
查看>>
通过容器编排和服务网格来改进Java微服务的可测性
查看>>
re:Invent解读:没想到你是这样的AWS
查看>>
PyTips 0x02 - Python 中的函数式编程
查看>>
使用《Deep Image Prior》来做图像复原
查看>>
Linux基础命令---rmdir
查看>>
Squid 反向代理服务器配置
查看>>
Java I/O操作
查看>>
Tomcat性能调优
查看>>
Android自学--一篇文章基本掌握所有的常用View组件
查看>>
灰度图像和彩色图像
查看>>
FreeMarker-Built-ins for strings
查看>>
argparse - 命令行选项与参数解析(转)
查看>>