Solaris8下 proftpd-1.2.10 + mysql-5.0.18 认证安装方法_VMware, Unix及操作系统讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  VMware, Unix及操作系统讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3964 | 回复: 0   主题: Solaris8下 proftpd-1.2.10 + mysql-5.0.18 认证安装方法        下一篇 
barry
注册用户
等级:中校
经验:1534
发帖:236
精华:2
注册:2012-1-13
状态:离线
发送短消息息给barry 加好友    发送短消息息给barry 发消息
发表于: IP:您无权察看 2012-2-15 11:31:04 | [全部帖] [楼主帖] 楼主

Solaris8下 proftpd-1.2.10 + mysql-5.0.18 认证安装方法


这几天和朋友花了三天的时间终于把proftpd+mysql在solaris8下安装好了,因为是新手所以费了很大的力气,今天把安装过程写下来,与大家交流。

安装前的准备:

1、配置gcc环境(在这就不多说了,如果有问题请查找资料,网上有许多)。配置好的标准是可以正确的安装其它的源码包。因为我的mysql和proftpd都是源码安装,所以gcc是必须的。

2、安装mysql,(CU上有相关的教程,请查阅),我的是源码安装,版本为5.0.18 , 安装路径为/usr/local/mysql

开始安装:

bash-2.03# cd /home/software
bash-2.03# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.10.tar.gz
bash-2.03# gunzip < proftpd-1.2.10.tar.gz tar xvf -
bash-2.03# cd proftpd.1.2.10
bash-2.03#./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 \
> --prefix=/usr/local/proftpd


说明:因为我的mysql是用的源码安装,安装路径为/usr/local/mysql,所以他的include库文件在/usr/local /mysql/include/mysql目录下面,他的lib库文件在/usr/local/mysql/lib/mysql目录下面,如mysql用的二进制包安装,请参考相关帮助文件将--with-includes和--with-libraries设置为你自己的路径。

bash-2.03# make
bash-2.03# make install


现在开始添加系统用户

bash-2.03# groupadd -g 5500 ftpgroup
bash-2.03# useradd -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser


proftpd安装结束,现在开始配置mysql数据库

登陆mysql

bash-2.03# mysql -uroot -p


在mysql中建立数据库proftpd

mysql> create database proftpd;


添加proftpd数据库的用户权限,proftpd数据库的用户名为:proftpd,密码为:123456,它只有查询、更新、插入的权限。

mysql> grant select,update,insert on proftpd.* to proftpd@localhost identified by '123456';


在proftpd数据库中建立数据表,proftpd使用mysql验证用户时一共使用4个表,分别是ftpuser,ftpgroup,ftpquotalimits,ftpquotatallies。下面是建立这4个表的sql语句。

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';
# --------------------------------------------------------
#
# Table structure for 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;
# --------------------------------------------------------
#
# Table structure for table `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;
#
# Table structure for table `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/ftp/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后用户将不能上传文件。

下面是/usr/local/proftpd/etc/proftpd.conf文件的内容。

ServerName "SPST.CN FTP Server"
ServerType Standalone
ServerAdmin ptsmy@163.com
# Hide as much as possible to outside users
ServerIdent on "Welcome to SPST.CN FTP server. Please login..."
DeferWelcome on
DefaultServer on
# Allow FTP resuming.
# Remember to set to off if you have an incoming ftp for upload.
AllowStoreRestart on
# Port 21 is the standard FTP port.
Port 21
# 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
# 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
# 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@localhost proftpd 123456
# 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
# create a user's home directory on demand if it doesn't exist
SQLHomedirOnDemand on
# 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
# 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@localhost proftpd 123456


到这里proftpd已经安装成功,你可以使用test用户登陆测试,如安装过程中有什么问题,可以与我交流。

另外说明:本人刚开始学习solaris,水平有限。这篇文章是我参考linux平台下的一篇文件写的,经过自己安装后没有问题,所以将安装过程回忆后记录下来。文章中的解释性内容较少,如有需要可以参考其它文章。




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论