`
jimmy.shine
  • 浏览: 389655 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Proftpd 配置

 
阅读更多

1、下载proftpd. 地址为: http://proftpd.org

2、编译安装

 

./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=/usr/local/mysql/include/mysql --with-libraries=/usr/local/mysql/lib/mysql --enable-ctrls --enable-nls --enable-shadow --enable-dso --enable-autoshadow --enable-auth-pam

make 

make install

proftpd默认安装在/usr/local/sbin中,若需要换目录,则在编译时候指定 --prefix=/usr/local/proftpd

3、配置mysql

(1)修改配置,centos中默认mysql的配置地点在/etc/my.cnf,可以加上指定编码为UTF-8

 

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server=UTF8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysql]
default-character-set=UTF8

(2)启动数据库

(3)修改数据库ROOT密码

 

mysqladmin -uroot password 'password'  --'password'为你想指定的密码

(4)创建数据库及增加用户

mysql -uroot -ppassword

 

create database proftpd default charset UTF8;
grant all privileges on proftpd.* to proftpd@localhost identified by 'proftpd'

(5)增加数据库表

 

CREATE TABLE `ftpuser` (
  `userid` text NOT NULL,
  `passwd` text NOT NULL,
  `uid` int(11) NOT NULL,
  `gid` int(11) NOT NULL,
  `homedir` text,
  `shell` text,
  `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'
) 

CREATE TABLE `ftpgroup` (
  `groupname` text NOT NULL,
  `gid` smallint(6) NOT NULL,
  `members` text NOT NULL
)

CREATE TABLE `quotalimits` (
  `quota_name` varchar(30) DEFAULT NULL,
  `quota_type` enum('user','group','class','all') NOT NULL,
  `per_session` enum('false','true') NOT NULL,
  `limit_type` enum('soft','hard') NOT NULL,
  `bytes_in_avail` float NOT NULL,
  `bytes_out_avail` float NOT NULL,
  `bytes_xfer_avail` float NOT NULL,
  `files_in_avail` int(10) unsigned NOT NULL,
  `files_out_avail` int(10) unsigned NOT NULL,
  `files_xfer_avail` int(10) unsigned NOT NULL
) 

CREATE TABLE `quotatallies` (
  `quota_name` varchar(30) NOT NULL,
  `quota_type` enum('user','group','class','all') NOT NULL,
  `bytes_in_used` float NOT NULL,
  `bytes_out_used` float NOT NULL,
  `bytes_xfer_used` float NOT NULL,
  `files_in_used` int(10) unsigned NOT NULL,
  `files_out_used` int(10) unsigned NOT NULL,
  `files_xfer_used` int(10) unsigned NOT NULL
) 

4、配置/usr/local/etc/proftpd.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			"FTP Server in HK"
ServerType			standalone
DefaultServer			on

# Port 21 is the standard FTP port.
Port				21

#UseEncoding UTF-8 GBK
# 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

# 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
<Limit SITE_CHMOD>
  DenyAll
</Limit>

# A basic anonymous configuration, no upload directories.  If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
#<Anonymous ~ftp>
#  User				ftp
#  Group				ftp

  # 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
#  <Limit WRITE>
#    DenyAll
#  </Limit>
#</Anonymous>

QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits "Kb"
QuotaLog "/usr/local/proftpd/var/quota"
QuotaShowQuotas on
SQLNamedQuery get-quota-limit SELECT "quota_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 quotalimits WHERE quota_name = '%{0}' AND quota_type = '%
{1}'"  
SQLNamedQuery get-quota-tally SELECT "quota_name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, 
files_out_used, files_xfer_used FROM quotatallies  WHERE quota_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 quota_name = '%{6}' AND quota_type = '%{7}'" quotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" quotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

SQLConnectInfo proftpd@localhost:3366 proftpd proftpd
SQLAuthTypes Backend Plaintext
SQLUserInfo ftpuser userid passwd uid gid homedir shell
SQLGroupInfo ftpgroup groupname gid members
RequireValidShell off
SQLAuthenticate users groups usersetfast groupsetfast
CreateHome on
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
DeferWelcome on
RootLogin off

6、创建FTP用的用户和群组,在配置文件中使用的。

 

groupadd –g 2012 ftpGroup
useradd –u 2012 –g ftpGroup –d /data ftpUser

7、插入用户至数据库表中(这是实际使用当中的FTP账号)

 

INSERT INTO `proftpd`.`ftpuser`
(`userid`,
`passwd`,
`uid`,
`gid`,
`homedir`,
`shell`,
`count`,
`accessed`,
`modified`)
VALUES
(
'proftpd',
password('proftpd'),
2012,
2012,
'/data/ftp/proftpd',
'/bin/nologin',
0,
'0000-00-00 00:00:00',
'0000-00-00 00:00:00'
);

INSERT INTO `proftpd`.`ftpgroup`
(`groupname`,
`gid`,
`members`)
VALUES
(
'ftpGroup',
2012,
'ftpUsers'
);

8、启动mysql,proftpd

 

/etc/init.d/mysqld start
/usr/local/sbin/proftpd

 

9、其它

(1)如何将proftpd加入到服务当中

a. 复制源文件中 contrib/dist/rpm/proftpd.init.d 至 /etc/init.d中

b. 编辑 /etc/init.d/functions中,在path后面加上 /usr/local/sbin

c. 编辑 /etc/init.d/proftpd, 改其中 为 [ -x /usr/local/sbin/proftpd ] || exit 5

d. 将proftpd改为可执行

 

chmod +x /etc/init.d/proftpd

e. 添加服务

chkconfig --level 35 proftpd on
chkconfig --add proftpd

(2)从外面访问不到,要注意防火墙的问题,编辑 /etc/sysconfig/iptables, 是里面加入

-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

重新启动

/etc/init.d/iptables restart

(3)如果通过ssh访问的时候,有乱码,可以编辑 /etc/sysconfig/i18n

 

LANG="zh_CN.UTF-8"
SUPPORTED="zh_CN:zh_CN.UTF-8:zh_CN.GBK:zh:en_US.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16"

(4)对于用户上传下载数量的限制,通过quota来实现,在quota*表中插入数据,具体可以GOOGLE

 

备注:

1、在/etc/hosts是一定要对于主机名绑定IP,否则无法启动。

如: 127.0.0.1   ftpServer

2、mysql devel必须要安装上,否则无法编译proftpd

3、FTP下的目录的用户与群组必须与创建的对应上。

   # chown -R ftpUser:ftpGroup /data/

分享到:
评论

相关推荐

    proftpd配置[收集].pdf

    proftpd配置[收集].pdf

    Linux系统proftpd配置

    提供Linux系统下proftp安装,配置。

    ProFtpd 配置

    教会你怎么利用ProFtpd服务(FTP)

    proftpd + mysql + quota配置完全指南

    proftpd + mysql + quota配置完全指南proftpd + mysql + quota配置完全指南proftpd + mysql + quota配置完全指南proftpd + mysql + quota配置完全指南

    proftpd-cookbook:厨师食谱来安装和配置ProFTPD

    系统用户拥有ProFTPD配置文件。 node['proftpd']['conf_files_group'] 'root' 拥有ProFTPD配置文件的系统组。 node['proftpd']['conf_files_mode'] '00640' ProFTPD配置文件系统文件模式位。 node['proftpd'...

    AIX_5L下proftpd安装配置

    AIX_5L下proftpd安装配置手册

    centos7下proftpd+mysql安装配置.zip

    proftpd全称:Professional FTP daemon,是针对Wu-FTP的弱项而开发的,除了改进的安全性,还具备许多Wu-FTP没有的特点,能以Stand-alone、xinetd模式运行等。ProFTP已经成为继Wu-FTP之后最为流行的FTP服务器软件,...

    proftpd安装和配置,2分钟搞定

    压缩包,包含配置文件和安装文件(proftpd-1.3.4b.tar.gz) 不需要太多的修改,就可以完成ftp的配置。 实现:指定用户访问一个特定的目录,不允许匿名登录

    proftpd.tar.gz

    proftpd服务工具,解压后进入proftpd目录,运行 sh init.sh 脚本,输入登陆FTP的密码(用户名为当前登陆的用户名,不能使用root用户)确认默认的8021端口是否被占用,如果占用,修改 etc/proftpd.conf配置里的端口号,...

    proftpd安装.rar

    centos7.9安装编proftpd,带配置文件,添加虚拟用户,配置用户目录权限

    Debian 5.0 下的 proftpd + mysql虚拟用户认证配置

    Debian 5.0 下的 proftpd + mysql虚拟用户认证配置 详细配置文档,能够正常通过mysql数据库中用户信息登录ftp服务器,测试通过!

    Linux下proftpd的安装配置与管理方法

    绍Linux下proftpd的安装配置与管理方法。

    proftpd 简介

    它是原来世界范围使用最广泛的wu-ftpd的改进版,它修正了wu-ftpd的许多缺陷,在许多方面进行了重大的改进,其中一个重要变化就是它学习了Apache 的配置方式,使proftpd的配置和管理更加简单易懂。本文将介绍它在Red ...

    Linux下配置FTP服务(Proftpd)

    1.配置FTP服务器,能够实现要求的功能; a.限制用户上传的速率为30K/s; b.限制每个IP只能用3个进程连接; c.最大支持500用户连接服务器; d.ftp用户只能上传,不能下载,不能删除,不能改名字。 e.teacher用户具有...

    proftpd-mod_dynamic_include:proftpd模块

    在登录阶段动态加载proftpd配置 用法 /etc/proftpd.conf LoadModule mod_dynamic_include.c DynamicIncludePath /etc/proftpd/%u.conf 格式规格 %u user name ( sent by 'USER' command ) 发展 # build && testing ...

    proftpd1.2 linux下的ftp服务器软件(红帽子rpm)

    proftpd1.2 linux下的ftp服务器软件,安装后可以用作ftp服务器使用,此服务器较为流行,安全性好,配置和apache的配置类似,只要更改相应的配置文件就可以进行配置

    proftpd:ProFTPD源代码

    ProFTPD是一个高度可配置的FTP守护程序,用于Unix和类似Unix的操作系统。 请参阅README.ports文件,以了解有关已知或认为在其上构建和运行ProFTPD的平台的更多详细信息。 ProFTPD源自对安全和可配置FTP服务器的需求...

    proftpd-1.3.7a.tar.gz

    proftpd-1.3.7a.tar.gz安装包 。ftp服务器端程序。配置相比,vsftpd简单。 可用于linux下。

    linux下简易Ftp服务器搭建:proftpd的安装与最简配置

    NULL 博文链接:https://lgcjava.iteye.com/blog/1992334

    linux proftpd-1.3.4c安装配置实例

    [root@chenghy ~]# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.4c.tar.gz [root@chenghy ~]# tar zxvf proftpd-1.3.4c.tar.gz [root@chenghy ~]# cd proftpd-1.3.4c [root@chenghy ~]# ./configure --...

Global site tag (gtag.js) - Google Analytics