centos7 安装配置 proftpd 与 mysql

1.添加源

rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm

2.安装proftpd

yum install proftpd proftpd-mysql proftpd-utils

3.安装mysql 略

4.配置mysql

添加数据库 ftpd 添加用户并授予权限

添加2个表

CREATE TABLE IF NOT EXISTS `ftpgroup` (
`groupname` varchar(16) COLLATE utf8_general_ci NOT NULL,
`gid` smallint(6) NOT NULL DEFAULT ‘5500’,
`members` varchar(16) COLLATE utf8_general_ci NOT NULL,
KEY `groupname` (`groupname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT=’ProFTP group table’;

CREATE TABLE IF NOT EXISTS `ftpuser` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`userid` varchar(32) COLLATE utf8_general_ci NOT NULL DEFAULT ”,
`passwd` varchar(32) COLLATE utf8_general_ci NOT NULL DEFAULT ”,
`uid` smallint(6) NOT NULL DEFAULT ‘5500’,
`gid` smallint(6) NOT NULL DEFAULT ‘5500’,
`homedir` varchar(255) COLLATE utf8_general_ci NOT NULL DEFAULT ”,
`shell` varchar(16) COLLATE utf8_general_ci 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=utf8 COLLATE=utf8_general_ci COMMENT=’ProFTP user table’;

4.修改proftpd配置文件

sudo vi /etc/proftpd.conf

添加:

RequireValidShell off

注释掉:

#AuthPAMConfig proftpd

#AutoOrder mod_auth_pam.c* mod_auth_unix.c

取消注释:

LoadModule mod_sql.c
LoadModule mod_sql_mysql.c

再次添加:

SQLBackend mysql

#Passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext
SQLAuthenticate users groups

# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo mysql_database@localhost mysql_user mysql_password

# Here we tell ProFTPd the names of the database columns in the “usertable”
# we want it to interact with. Match the names with those in the db
SQLUserInfo ftpuser userid passwd uid gid homedir shell

# Here we tell ProFTPd the names of the database columns in the “grouptable”
# we want it to interact with. Again the names match with those in the db
SQLGroupInfo ftpgroup groupname gid members

# set min UID and GID – otherwise these are 999 each
SQLMinID 500

# 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

SqlLogFile /var/log/proftpd/sql.log

注:SQLConnectInfo mysql_database@localhost mysql_user mysql_password 替换成设置的数据库信息 数据库@IP 用户名 密码

5.添加用户测试

参考设置

centos7 安装配置 proftpd 与 mysql》有一个想法

回复 匿名 取消回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注