安装MySQL:
需要下载MySQL5.0(从我的安装的经验来看mod_sql 不支持5.5)
http://dev.mysql.com/
安装Shared components(这是首先要做的,否则在安装Server时,会告诉你缺少依赖)
#rpm –ivh MySQL-shared-5.0.95-1.glibc23.i386.rpm
安装MySQL Server
#rpm -ivh MySQL-server-5.0.95-1.glibc23.i386.rpm
安装Client Utilities
#rpm -ivh MySQL-client-5.0.95-1.glibc23.i386.rpm
如果安装失败可以使用rpm –e <名字>.rpm
来卸载
创建数据库
#/usr/bin/mysql_install_db --user=mysql
(MySQL安装完毕,会自动的创建一个数据库。如果自动创建失败,可以使用)
修改密码
# /usr/bin/mysqladmin -u root -p password
123456
回车出现 Enter password: 最开始密码默认为空 继续回车即可
数据库状态
Service
mysql status
没有启动 MySQL is not running [失败]
正常启动 MySQL running
(29095) [确定]
启动异常 MySQL is not running but lock exists [失败]
(这个问题,可能是之前安装的MySQL没有完全卸载,
rm
/var/lock/subsys/mysql 就可以解决)
启动失败 Starting MySQL.Manager of
pid-file quit without updating fi[失败]
(杀掉已经启动的进程:
[root@localhost mysql]# ps -A|grep mysql
8016 pts/2 00:00:00 mysqld_safe
8037 pts/2 00:00:00 mysqld
Kill -9 8016,8037
安装Proftpd:
需要下载最新版本的Proftpd,http://www.proftpd.org/
需要编译,安装
./configure
--prefix=/usr/local/proftpd
--with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql
--with-includes=/usr/include/mysql --with-libraries=/usr/lib/
make
make
install
(如果编译过程中,出现编译错误。那么就需要检查下是否是mysql的开发包没有安装或者是Mysql的版本太新,Proftp的的版本太旧导致的。我比较倒霉,这样的问题层出不穷。)
配置Proftpd,对/usr/local/proftpd/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 "shannxiUmsFTPServer"
ServerType standalone
DefaultServer 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
# 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 nobody
#Group nogroup
Group nobody
# 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>
# The
passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext Crypt
SQLAuthenticate users* groups*
# used
to connect to the database
#
databasename@host database_user user_password
SQLConnectInfo proftpd@127.0.0.1 root 123456
#if
homedir is not exsit,will create it.
CreateHome
on
# 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
/usr/local/proftpd/log.txt
# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
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
RootLogin
off
RequireValidShell
off
########################################################################################################################################################
以上配置文件需要注意的是:
SQLConnectInfo proftpd@127.0.0.1 root 123456
如果你采用host=localhost,那么你很可能会获得
ERROR
2002 (HY000): Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' 的错误,在SQLLOGFile中。
你可以通过mysqladmin -uroot -p variables
|grep socket 来检查mysql.sock位置是否正确。如果你觉得你的配置都正确,但是。。还无法解决。那么你可以将localhost更换成127.0.0.1试试。
#Group nogroup
Group nobody
RedHat
Enterprise 5.5 没有nogroup 用户,所以使用nobody来代替。
#配置系统用户
# groupadd -g 5500 ftpgroup
# useradd –u 5500 –d /home/ftpuser –s /sbin/nologin -m -g ftpgroup ftpuser
配置Mysql
#创建数据库
mysql> create database proftpd
#添加proftpd数据库的用户权限,proftpd数据库的用户名为:proftpd,密码为:123456,它只有查询、更新、插入的权限。 配置为@localhost,那么就只能通过本地来登录。
mysql> grant select,update,insert on proftpd.* to proftpd@localhost identified by '123456';
在proftpd数据库中建立数据表,proftpd使用mysql验证用户时一共使用4个表,分别是ftpuser,ftpgroup,ftpquotalimits,ftpquotatallies。下面是建立这4个表的sql语句
###########################################################################
###########################################################################
# ftpgroup
CREATE TABLE ftpgroup (
groupname varchar(16) NOT NULL default '',
gid smallint(6) NOT NULL default '5500',
members varchar(16) NOT NULL default '',
KEY groupname (groupname)
) TYPE=MyISAM COMMENT='ProFTP group table';
# ftpquotalimits
CREATE TABLE 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'
) TYPE=MyISAM;
#
ftpquotatallies
CREATE TABLE 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'
) TYPE=MyISAM;
#
ftpuser
CREATE TABLE 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 '5500',
gid smallint(6) NOT NULL default '5500',
homedir varchar(255) NOT NULL default '',
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)
) TYPE=MyISAM COMMENT='ProFTP user table';
# 数据表建立成功后加入测试帐号test,安装成功后你可以用这个帐号测试
INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpuser');
INSERT INTO `ftpuser` VALUES (1, 'test', 'test', 5500, 5500, '/home/ftpuser/test', '/sbin/nologin',0,'','');
INSERT INTO `ftpquotalimits` VALUES ('test','user','false','hard','15728640','0','0','0','0','0');
这时数据库中已经有一个用户,用户名为:test,密码为:test,用户根目录为:/home/ftp/test,他的空间大小限制为15M,超过 15M后用户将不能上传文件。
配置用户权限,proftpd的用户权限控制是很完备的。
配置可以参考如下:
<Limit
RMD RNTO DELE STOR MKD SITE_CHMOD RNTO>
DenyUser test
</Limit>
删除目录(RMD),删除文件(DEL),和执行chmod命令(SITE_CHMOD),上传(STOR),建目录(MKD),下载(RETR),重命名(RNTO)
日志:
Proftpd记录的日志一般在
/var/log/xferlog
/var/log/messages
分享到:
相关推荐
./configure --prefix=/home/proftpd/proftpd --with-includes=mysql/include --with-libraries=mysql/lib --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql make make install ``` 4. **...
**Apache Web Server的服务质量模块mod_qos** Apache HTTP Server是一款广泛应用的开源Web服务器,它提供了丰富的功能和灵活性,可满足各种网站需求。而mod_qos(Quality of Service)是Apache的一个扩展模块,专门...
本压缩包含:Apache 2.0.50 源码PHP 4.2.7 Final 源码MySQL 4.0.20.i686 (无须编译)ProFTP 1.2.10.RC1 源码用于Linux系统下编译安装使用,内附Linux下编译安装配置文档,希望对大家有所帮助:)
./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \ --with-includes=/usr/include/mysql \ --with-libraries=/usr/lib \ --prefix=/usr/local/proftpd ``` 其中`--with-...
ProFTP已经成为继Wu-FTP之后最为流行的FTP服务器软件,越来越多的站点选用它构筑安全高效的FTP站点,ProFTP配置方便,并有MySQL和Quota模块可供选择,利用它们的完美结合可以实现非系统账号的管理和用户磁盘的限制。...
本文介绍了配置Proftp服务的小技巧:配置Ftp允许Root登录、实现Root用户Ftp后可以切换到/目录等。
ProFTPD支持许多模块,如mod_sql用于SQL数据库认证,mod_sftp支持SFTP协议等。启用模块只需在配置文件中包含模块名。 6. **日志与监控** ProFTPD的日志可以自定义输出格式和位置,例如: ``` ServerLog "/var/...
主要的源文件包括`proftpd.c`(主程序入口)、`mod_tls.c`(TLS/SSL支持)和`mod_sql.c`(SQL数据库集成)等。 2. **配置与定制** ProFTPD的配置文件通常为`proftpd.conf`,允许管理员自定义各种设置,如监听端口...
**ProFTP源代码详解** ProFTP是一款在Unix和Linux操作系统上广泛应用的开源FTP服务器软件。它的设计目标是提供一个安全、高效且可高度定制的FTP服务解决方案。通过研究和理解ProFTP的源代码,我们可以深入探究其...
- 熟悉TCP/IP协议族,实现如Apache+PHP+ProFTP+MySQL+Quota的组合。 - 企业级应用解决方案,包括大型局域网和分布式集群。 6. **多用户管理和安全管理**: - 学习如何在Linux系统中管理多个用户,设置权限,保障...
1.用ProFTP 构建FTP服务器.docx
./configure --prefix=/usr/local/proftpd-1.3.3 --sysconfdir=/etc/proftpd --with-modules=mod_ifsession ``` 这里指定了安装路径、配置文件路径以及启用的模块。其中`--with-modules=mod_ifsession`表示启用...
安装过程中需要下载ProFTPd源码包proftpd-1.2.8.tar.gz以及磁盘配额模块proftpd-mod-quotatab-1.2.7.tar.gz,这些源码包分别用于搭建FTP服务器以及管理用户磁盘配额。 搭建FTP服务器的关键步骤如下: 1. 首先,...
python cpx_proftp.py <IP> <REMOTE> 前任: python cpx_proftp.py 127.0.0.1 /etc/passwd /var/www/pass.txt 然后尝试: http://127.0.0.1/pass.txt ###方法2: 用法: python cpx_proftp.py <IP> 前任:...
例如,`mod_tls`模块提供SSL/TLS加密支持,`mod_sql`模块则支持数据库认证等功能。 - **虚拟主机**: - 可以在同一台服务器上配置多个独立的FTP站点,每个站点可以有不同的配置文件和认证方式。 - **安全性和性能...
NULL 博文链接:https://lindows.iteye.com/blog/250576
CuteFTP Pro是一款知名的FTP客户端软件,用于在本地计算机与远程服务器之间进行文件传输。FTP,全称为File Transfer Protocol(文件传输协议),是互联网上最基础的服务之一,用于在不同网络环境之间交换文件。...
添加虚拟用户涉及创建数据库表,配置ProFTPD与数据库的连接,并在配置文件中启用虚拟用户模块,如`mod_vuser`。 7. **配置用户目录权限**: 用户的FTP访问权限可以通过配置文件来控制,例如指定用户的主目录、...
解压密码:123 ||从选项屏幕,你可以有一个非常广泛的配置设置,如当涉及到自动重新连接,缓冲区sozes,缓存以及快速连接时,你可以编辑连接属性。它允许你设置日期,大小和缩略图的显示选项。您还可以使用...
...