热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

配置ProFTPd服务器的MySQL方式认证

下载wgethttp://cloud.github.com/downloads/proftpd/proftpd.github.com/proftpd-1.3.4rc2.tar.gztarzxvfproftpd-1.3.4rc2.tar.gzcdproftpd-1.3.4rc2./configure--prefix/us

下载 wget http://cloud.github.com/downloads/proftpd/proftpd.github.com/proftpd-1.3.4rc2.tar.gz

tar zxvf proftpd-1.3.4rc2.tar.gz

cd proftpd-1.3.4rc2

./configure--prefix=/usr/local/proftp \

--with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \

--with-includes=/usr/include/mysql \

--with-libraries=/usr/lib/mysql \

make && make install

解释

--with-includes: 指定MySQL服务器includes所在的位置,mysql的include文件通常是.h结尾,

--with-libraries:指定MySQL服务器libraries所在的位置,mysql的库文件通常是*结尾

到此proftp已安装结束

mysql安装方式 yum安装编译安装。

创建数据库proftp(utf-8)

导入附件中sql文件或,输入

CREATE TABLE IF NOT EXISTS `ftpgroup` (

  `groupname` varchar(16) NOT NULL default '',

  `gid` smallint(6) NOT NULL default '5500',

  `members` varchar(16) NOT NULL default '',

  KEY `groupname` (`groupname`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='ProFTP group table';

-- --------------------------------------------------------

--

-- Table structure for table `ftpquotalimits`

--

CREATE TABLE IF NOT EXISTS `ftpquotalimits` (

  `name` varchar(30) default NULL,

  `quota_type` enum('user','group','class','all') NOT NULL default 'user',

  `per_session` enum('false','true') NOT NULL default 'false',

  `limit_type` enum('soft','hard') NOT NULL default 'soft',

  `bytes_in_avail` int(10) unsigned NOT NULL default '0',

  `bytes_out_avail` int(10) unsigned NOT NULL default '0',

  `bytes_xfer_avail` int(10) unsigned NOT NULL default '0',

  `files_in_avail` int(10) unsigned NOT NULL default '0',

  `files_out_avail` int(10) unsigned NOT NULL default '0',

  `files_xfer_avail` int(10) unsigned NOT NULL default '0'

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--

-- Table structure for table `ftpquotatallies`

--

CREATE TABLE IF NOT EXISTS `ftpquotatallies` (

  `name` varchar(30) NOT NULL default '',

  `quota_type` enum('user','group','class','all') NOT NULL default 'user',

  `bytes_in_used` int(10) unsigned NOT NULL default '0',

  `bytes_out_used` int(10) unsigned NOT NULL default '0',

  `bytes_xfer_used` int(10) unsigned NOT NULL default '0',

  `files_in_used` int(10) unsigned NOT NULL default '0',

  `files_out_used` int(10) unsigned NOT NULL default '0',

  `files_xfer_used` int(10) unsigned NOT NULL default '0'

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--

-- Table structure for table `ftpuser`

--

CREATE TABLE IF NOT EXISTS `ftpuser` (

  `id` int(10) unsigned NOT NULL auto_increment,

  `userid` varchar(32) NOT NULL default '',

  `passwd` varchar(32) NOT NULL default '',

  `uid` smallint(6) NOT NULL default '2001',

  `gid` smallint(6) NOT NULL default '2001',

  `homedir` varchar(255) NOT NULL default '/home/web',

  `shell` varchar(16) NOT NULL default '/sbin/nologin',

  `count` int(11) NOT NULL default '0',

  `accessed` datetime NOT NULL default '0000-00-00 00:00:00',

  `modified` datetime NOT NULL default '0000-00-00 00:00:00',

  PRIMARY KEY  (`id`),

  UNIQUE KEY `userid` (`userid`)

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COMMENT='ProFTP user table' AUTO_INCREMENT=0 ;

备份原proftpd.conf文件,copy 附件中配置并修改以下几处内容

cp /usr/local/proftp/etc/proftpd.conf/usr/local/proftp/etc/proftpd.conf-bak

vi /usr/local/proftp/etc/proftpd.conf

替换以下内容(此部分可见文件夹中proftp.conf)

# This is a basic ProFTPD configuration file (rename it to

# 'proftpd.conf' for actual use.  It establishes a single server

# and a single anonymous login.  It assumes that you have a user/group

# "nobody" and "ftp" for normal operation and anon.

ServerName               "ProFTPD Default Installation"

ServerType                 standalone

DefaultServer                    on

DefaultAddress                 192.168.3.58

#SocketBindTight on

# Port 21 is the standard FTP port.

Port                            21

# Don't use IPv6 support by default.

UseIPv6                      off

# Umask 022 is a good standard umask to prevent new dirs and files

# from being group and world writable.

Umask                        022 022

AllowRetrieveRestart            on

AllowStoreRestart               on

SyslogLevel warn

# To prevent DoS attacks, set the maximum number of child processes

# to 30.  If you need to allow more than 30 concurrent connections

# at once, simply increase this value.  Note that this ONLY works

# in standalone mode, in inetd mode you should use an inetd server

# that allows you to limit maximum number of processes per service

# (such as xinetd).

MaxInstances                    30

# Set the user and group under which the server will run.

User                            ftpuser

Group                         ftpgroup

# To cause every FTP user to be "jailed" (chrooted) into their home

# directory, uncomment this line.

DefaultRoot ~

# Normally, we want files to be overwriteable.

AllowOverwrite          on

# Bar use of SITE CHMOD by default

#

#  DenyAll

#

# A basic anonymous configuration, no upload directories.  If you do not

# want anonymous users, simply delete this entire section.

#

#  User                      ftp

#  Group                          ftpg

#  # We want clients to be able to login with "anonymous" as well as "ftp"

#  UserAlias                     anonymous ftp

#  # Limit the maximum number of anonymous logins

#  MaxClients                  10

#  # We want 'welcome.msg' displayed at login, and '.message' displayed

#  # in each newly chdired directory.

#  DisplayLogin                welcome.msg

#  DisplayChdir                .message

#  # Limit WRITE everywhere in the anonymous chroot

#    DenyAll

#

#LangPath        /usr/share/locale

#LangEngine on

#UseEncoding on #UTF-8 UTF-8

SQLAuthTypes Backend Plaintext

SQLAuthenticate users* groups*

# databasename@host database_user user_password

SQLConnectInfo  yourDBname@yourDBhost youeDBuser yourDBpass

#usertable ftpuser

SQLNamedQuery ftpuserinfo SELECT "userid,passwd,uid,gid,homedir,shell from ftpuser where userid = '%U' and count <1"

SQLUserInfo custom:/ftpuserinfo

#SQLUserInfo ftpuser userid passwd uid gid homedir shell

#SQLLogFile "/usr/local/proftpd/sqllog"

SQLGroupInfo ftpgroup groupname gid members

#SQLHomedirOnDemand on

CreateHome  on

SQLDefaultGID 2001

SQLDefaultUID 2001

# Update count every time user logs in

SQLLog PASS updatecount

SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() WHERE userid='%u'" ftpuser

# Update modified everytime user uploads or deletes a file

SQLLog STOR,DELE modified

SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser

QuotaEngine on

QuotaDirectoryTally on

QuotaDisplayUnits Mb

QuotaShowQuotas on

#QuotaLog "/var/log/quota"

SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"

SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"

SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" ftpquotatallies

SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies

QuotaLimitTable sql:/get-quota-limit

QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

UseReverseDns off

IdentLookups off

修改以下2处

DefaultAddress修改为本ftp所在服务器ip地址

SQLConnectInfo  yourDBname@yourDBhost youeDBuser yourDBpass

修改数据名数据库用户及密码

1、添加ftp运行用户及组

groupadd ftpgroup -g 2001

adduser ftpuser -u 2001 -g 2001 -d /var/ftp -s /sbin/nologin

ps:uid 和gid 号可以自定义,设置后需要修改proftp.conf中SQLDefaultGID 2001

SQLDefaultUID 2001这两处,这里我新建的就是2001 所以proftp中我就没有修改

2、添加 ftp虚拟用户及组

groupadd ftpusers -g 2002

adduser proftp -u 2002 -g 2001 -d /var/ftp -s /sbin/nologin

ps:添加ftp用户,将其组加入到proftp运行组中,虚拟用户将继承2002 用户权限

在数据库中插入

INSERT INTO `proftp`.`ftpgrps` (`groupname`, `gid`, `members`) VALUES ('ftpgroup', '2001', 'ftpuser');

INSERT INTO `proftp`.`ftpgrps` (`groupname`, `gid`, `members`) VALUES ('ftpusers', '2002', 'proftp');


推荐阅读
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 本文介绍了如何使用php限制数据库插入的条数并显示每次插入数据库之间的数据数目,以及避免重复提交的方法。同时还介绍了如何限制某一个数据库用户的并发连接数,以及设置数据库的连接数和连接超时时间的方法。最后提供了一些关于浏览器在线用户数和数据库连接数量比例的参考值。 ... [详细]
  • [译]技术公司十年经验的职场生涯回顾
    本文是一位在技术公司工作十年的职场人士对自己职业生涯的总结回顾。她的职业规划与众不同,令人深思又有趣。其中涉及到的内容有机器学习、创新创业以及引用了女性主义者在TED演讲中的部分讲义。文章表达了对职业生涯的愿望和希望,认为人类有能力不断改善自己。 ... [详细]
  • 一、Hadoop来历Hadoop的思想来源于Google在做搜索引擎的时候出现一个很大的问题就是这么多网页我如何才能以最快的速度来搜索到,由于这个问题Google发明 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 推荐一个ASP的内容管理框架(ASP Nuke)的优势和适用场景
    本文推荐了一个ASP的内容管理框架ASP Nuke,并介绍了其主要功能和特点。ASP Nuke支持文章新闻管理、投票、论坛等主要内容,并可以自定义模块。最新版本为0.8,虽然目前仍处于Alpha状态,但作者表示会继续更新完善。文章还分析了使用ASP的原因,包括ASP相对较小、易于部署和较简单等优势,适用于建立门户、网站的组织和小公司等场景。 ... [详细]
  • 搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的详细步骤
    本文详细介绍了搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的步骤,包括环境说明、相关软件下载的地址以及所需的插件下载地址。 ... [详细]
  • 本文介绍了如何在MySQL中将零值替换为先前的非零值的方法,包括使用内联查询和更新查询。同时还提供了选择正确值的方法。 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • 在数据分析工作中,我们通常会遇到这样的问题,一个业务部门由若干业务组构成,需要筛选出每个业务组里业绩前N名的业务员。这其实是一个分组排序的 ... [详细]
  • Oracle Database 10g许可授予信息及高级功能详解
    本文介绍了Oracle Database 10g许可授予信息及其中的高级功能,包括数据库优化数据包、SQL访问指导、SQL优化指导、SQL优化集和重组对象。同时提供了详细说明,指导用户在Oracle Database 10g中如何使用这些功能。 ... [详细]
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • 本文详细介绍了MysqlDump和mysqldump进行全库备份的相关知识,包括备份命令的使用方法、my.cnf配置文件的设置、binlog日志的位置指定、增量恢复的方式以及适用于innodb引擎和myisam引擎的备份方法。对于需要进行数据库备份的用户来说,本文提供了一些有价值的参考内容。 ... [详细]
  • 本文由编程笔记小编整理,介绍了PHP中的MySQL函数库及其常用函数,包括mysql_connect、mysql_error、mysql_select_db、mysql_query、mysql_affected_row、mysql_close等。希望对读者有一定的参考价值。 ... [详细]
author-avatar
日韩潮衣一手临终批发
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有