免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 4977 | 回复: 12
打印 上一主题 下一主题

[FTP] [原创]Solaris8下 proftpd-1.2.10 + mysql-5.0.18 认证安装方法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-01-03 04:45 |只看该作者 |倒序浏览
这几天和朋友花了三天的时间终于把proftpd+mysql在solaris8下安装好了,因为是新手所以费了很大的力气,今天把安装过程写下来,与大家交流。

安装前的准备:

1、配置gcc环境(在这就不多说了,如果有问题请查找资料,网上有许多)。配置好的标准是可以正确的安装其它的源码包。因为我的mysql和proftpd都是源码安装,所以gcc是必须的。
2、安装mysql,(CU上有相关的教程,请查阅),我的是源码安装,版本为5.0.18 , 安装路径为/usr/local/mysql



开始安装:


  1. bash-2.03# cd /home/software
  2. bash-2.03# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.10.tar.gz
  3. bash-2.03# gunzip < proftpd-1.2.10.tar.gz | tar xvf -
  4. bash-2.03# cd proftpd.1.2.10
  5. bash-2.03#./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \
  6. > --with-includes=/usr/local/mysql/include/mysql \
  7. > --with-libraries=/usr/local/mysql/lib/mysql \
  8. > --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设置为你自己的路径。


  1. bash-2.03# make
  2. bash-2.03# make install
复制代码


现在开始添加系统用户


  1. bash-2.03# groupadd -g 5500 ftpgroup
  2. 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语句。


  1. CREATE TABLE ftpgroup (
  2. groupname varchar(16) NOT NULL default '',
  3. gid smallint(6) NOT NULL default '5500',
  4. members varchar(16) NOT NULL default '',
  5. KEY groupname (groupname)
  6. ) TYPE=MyISAM COMMENT='ProFTP group table';



  7. # --------------------------------------------------------

  8. #
  9. # Table structure for table `ftpquotalimits`
  10. #

  11. CREATE TABLE ftpquotalimits (
  12. name varchar(30) default NULL,
  13. quota_type enum('user','group','class','all') NOT NULL default 'user',
  14. per_session enum('false','true') NOT NULL default 'false',
  15. limit_type enum('soft','hard') NOT NULL default 'soft',
  16. bytes_in_avail int(10) unsigned NOT NULL default '0',
  17. bytes_out_avail int(10) unsigned NOT NULL default '0',
  18. bytes_xfer_avail int(10) unsigned NOT NULL default '0',
  19. files_in_avail int(10) unsigned NOT NULL default '0',
  20. files_out_avail int(10) unsigned NOT NULL default '0',
  21. files_xfer_avail int(10) unsigned NOT NULL default '0'
  22. ) TYPE=MyISAM;

  23. # --------------------------------------------------------

  24. #
  25. # Table structure for table `ftpquotatallies`
  26. #

  27. CREATE TABLE ftpquotatallies (
  28. name varchar(30) NOT NULL default '',
  29. quota_type enum('user','group','class','all') NOT NULL default 'user',
  30. bytes_in_used int(10) unsigned NOT NULL default '0',
  31. bytes_out_used int(10) unsigned NOT NULL default '0',
  32. bytes_xfer_used int(10) unsigned NOT NULL default '0',
  33. files_in_used int(10) unsigned NOT NULL default '0',
  34. files_out_used int(10) unsigned NOT NULL default '0',
  35. files_xfer_used int(10) unsigned NOT NULL default '0'
  36. ) TYPE=MyISAM;




  37. #
  38. # Table structure for table `ftpuser`
  39. #

  40. CREATE TABLE ftpuser (
  41. id int(10) unsigned NOT NULL auto_increment,
  42. userid varchar(32) NOT NULL default '',
  43. passwd varchar(32) NOT NULL default '',
  44. uid smallint(6) NOT NULL default '5500',
  45. gid smallint(6) NOT NULL default '5500',
  46. homedir varchar(255) NOT NULL default '',
  47. shell varchar(16) NOT NULL default '/sbin/nologin',
  48. count int(11) NOT NULL default '0',
  49. accessed datetime NOT NULL default '0000-00-00 00:00:00',
  50. modified datetime NOT NULL default '0000-00-00 00:00:00',
  51. PRIMARY KEY (id),
  52. UNIQUE KEY userid (userid)
  53. ) TYPE=MyISAM COMMENT='ProFTP user table';



  54. # 数据表建立成功后加入测试帐号test,安装成功后你可以用这个帐号测试

  55. INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpuser');
  56. INSERT INTO `ftpuser` VALUES (1, 'test', 'test', 5500, 5500, '/home/ftp/test', '/sbin/nologin',0,'','');
  57. 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文件的内容。


  1. ServerName                      "SPST.CN FTP Server"
  2. ServerType                      Standalone
  3. ServerAdmin                     ptsmy@163.com

  4. # Hide as much as possible to outside users
  5. ServerIdent                     on "Welcome to SPST.CN FTP server. Please login..."
  6. DeferWelcome                        on

  7. DefaultServer                   on

  8. # Allow FTP resuming.
  9. # Remember to set to off if you have an incoming ftp for upload.
  10. AllowStoreRestart               on

  11. # Port 21 is the standard FTP port.
  12. Port                            21

  13. # Umask 022 is a good standard umask to prevent new dirs and files
  14. # from being group and world writable.
  15. Umask                           022

  16. # To prevent DoS attacks, set the maximum number of child processes
  17. # to 30.  If you need to allow more than 30 concurrent connections
  18. # at once, simply increase this value.  Note that this ONLY works
  19. # in standalone mode, in inetd mode you should use an inetd server
  20. # that allows you to limit maximum number of processes per service
  21. # (such as xinetd).
  22. MaxInstances                    30

  23. # Set the user and group under which the server will run.
  24. User                            nobody
  25. Group                           nogroup

  26. # To cause every FTP user to be "jailed" (chrooted) into their home
  27. # directory, uncomment this line.
  28. DefaultRoot ~

  29. # Normally, we want files to be overwriteable.

  30.   AllowOverwrite                on


  31. # The passwords in MySQL are encrypted using CRYPT
  32. SQLAuthTypes            Plaintext Crypt
  33. SQLAuthenticate         users* groups*

  34. # used to connect to the database
  35. # databasename@host database_user user_password
  36. SQLConnectInfo  proftpd@localhost proftpd 123456

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

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

  43. # set min UID and GID - otherwise these are 999 each
  44. SQLMinID        500

  45. # create a user's home directory on demand if it doesn't exist
  46. SQLHomedirOnDemand on

  47. # Update count every time user logs in
  48. SQLLog PASS updatecount
  49. SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser

  50. # Update modified everytime user uploads or deletes a file
  51. SQLLog  STOR,DELE modified
  52. SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser

  53. # User quotas
  54. # ===========
  55. QuotaEngine on
  56. QuotaDirectoryTally on
  57. QuotaDisplayUnits Mb
  58. QuotaShowQuotas on

  59. 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}'"

  60. 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}'"

  61. 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

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

  63. QuotaLimitTable sql:/get-quota-limit
  64. QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally


  65. RootLogin off
  66. RequireValidShell off
复制代码


上面的内容你可以完全复制过去使用,需要注意的是下面数据库连接参数要与你自己设置的相同。

# 数据库名@数据库主机 数据库名称 数据库密码
SQLConnectInfo  proftpd@localhost proftpd 123456



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

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

[ 本帖最后由 ptsmy 于 2006-1-15 22:04 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-01-10 19:43 |只看该作者
bash-2.03#

solaris 8 下用的是bash?

论坛徽章:
0
3 [报告]
发表于 2006-01-15 22:05 |只看该作者

回复 2楼 wolfg 的帖子

我在LINUX下用bash用习惯了,所以也将solaris8换成了bash

论坛徽章:
2
2015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之上海
日期:2016-05-05 09:45:14
4 [报告]
发表于 2006-01-16 08:22 |只看该作者
我在SUN9下一直编译不成功,郁闷,,顶!!!

论坛徽章:
0
5 [报告]
发表于 2006-01-25 09:44 |只看该作者
请教LZ
完全按照LZ的步骤,在proftpd的编译时,出现make错误,出错信息如下
ld: warning: file /usr/local/mysql/lib/libmysqlclient.a(libmysql.o): wrong ELF class: ELFCLASS64
Undefined                       first referenced
symbol                             in file
make_scrambled_password             modules/mod_sql_mysql.o
mysql_fetch_row                     modules/mod_sql_mysql.o
mysql_ping                          modules/mod_sql_mysql.o
mysql_errno                         modules/mod_sql_mysql.o
mysql_error                         modules/mod_sql_mysql.o
mysql_options                       modules/mod_sql_mysql.o
mysql_init                          modules/mod_sql_mysql.o
mysql_num_fields                    modules/mod_sql_mysql.o
mysql_store_result                  modules/mod_sql_mysql.o
mysql_real_connect                  modules/mod_sql_mysql.o
mysql_real_query                    modules/mod_sql_mysql.o
mysql_close                         modules/mod_sql_mysql.o
mysql_real_escape_string            modules/mod_sql_mysql.o
mysql_field_count                   modules/mod_sql_mysql.o
mysql_free_result                   modules/mod_sql_mysql.o
mysql_num_rows                      modules/mod_sql_mysql.o
ld: fatal: Symbol referencing errors. No output written to proftpd
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `proftpd'

试了很多编都是这样,请问这是为什么?我的gcc是从sunfreeware上下载的2.95.3版本
请高手指点,时间紧迫,在线等待,万分感谢~~~~~~

论坛徽章:
0
6 [报告]
发表于 2006-01-25 13:10 |只看该作者
你的mysql安装的是什么版本的?

论坛徽章:
0
7 [报告]
发表于 2006-01-26 23:16 |只看该作者
没有碰以这类问题,我估计是环境变量设置有问题,请版主想想办法

[ 本帖最后由 ptsmy 于 2006-1-26 23:20 编辑 ]

论坛徽章:
0
8 [报告]
发表于 2006-01-27 10:55 |只看该作者
原帖由 ptsmy 于 2006-1-26 23:16 发表
没有碰以这类问题,我估计是环境变量设置有问题,请版主想想办法


参考
http://lists.mysql.org/perl/2373

估计是因为安装了64位的mysql,换32位的试试

论坛徽章:
0
9 [报告]
发表于 2006-02-05 15:46 |只看该作者
mysql换成了mysql-max-5.0.18-solaris8-32bit-sparc版本,make的时候问题依旧。
/usr/include/sys/ioctl.h:103: warning: this is the location of the previous definition
/usr/include/sys/termios.h:307: warning: `FLUSHO' redefined
/usr/include/sys/ioctl.h:104: warning: this is the location of the previous definition
/usr/include/sys/termios.h:308: warning: `PENDIN' redefined
/usr/include/sys/ioctl.h:110: warning: this is the location of the previous definition
gcc -Llib -o proftpd src/main.o src/timers.o src/sets.o src/pool.o src/regexp.o  src/dirtree.o src/support.o src/netaddr.o src/inet.o src/child.o  src/log.o src/xferlog.o src/bindings.o src/netacl.o src/class.o  src/scoreboard.o src/help.o src/feat.o src/netio.o src/response.o  src/ident.o src/data.o src/modules.o src/auth.o src/fsio.o  src/mkhome.o src/ctrls.o src/event.o modules/mod_core.o modules/mod_xfer.o modules/mod_auth_unix.o modules/mod_auth_file.o modules/mod_auth.o modules/mod_ls.o modules/mod_log.o modules/mod_site.o modules/mod_auth_pam.o modules/mod_sql_mysql.o modules/mod_sql.o  modules/module_glue.o -L/usr/local/mysql -lsupp -lsocket -lnsl -lresolv  -lm -lz -lmysqlclient  -lpam
ld: fatal: library -lmysqlclient: not found
ld: fatal: File processing errors. No output written to proftpd
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `proftpd'

请大虾救命啊~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

论坛徽章:
0
10 [报告]
发表于 2006-02-05 15:52 |只看该作者
更换gcc版本后故障照旧(从gcc 2.95--〉gcc3.32)

gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_core.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_xfer.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_auth_unix.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_auth_file.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_auth.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_ls.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_log.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_site.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_auth_pam.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_sql.c
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c mod_sql_mysql.c
srcdir=. ./glue.sh mod_core.o mod_xfer.o mod_auth_unix.o mod_auth_file.o mod_auth.o mod_ls.o mod_log.o mod_site.o mod_auth_pam.o mod_sql.o mod_sql_mysql.o
gcc  -DSOLARIS2_8 -DSOLARIS2 -I.. -I../include -I/usr/local/mysql/include -O2 -Wall -c module_glue.c
gcc -Llib -o proftpd src/main.o src/timers.o src/sets.o src/pool.o src/regexp.o  src/dirtree.o src/support.o src/netaddr.o src/inet.o src/child.o  src/log.o src/xferlog.o src/bindings.o src/netacl.o src/class.o  src/scoreboard.o src/help.o src/feat.o src/netio.o src/response.o  src/ident.o src/data.o src/modules.o src/auth.o src/fsio.o  src/mkhome.o src/ctrls.o src/event.o modules/mod_core.o modules/mod_xfer.o modules/mod_auth_unix.o modules/mod_auth_file.o modules/mod_auth.o modules/mod_ls.o modules/mod_log.o modules/mod_site.o modules/mod_auth_pam.o modules/mod_sql_mysql.o modules/mod_sql.o  modules/module_glue.o -L/usr/local/mysql/lib -lsupp -lsocket -lnsl -lresolv  -lm -lz -lmysqlclient  -lpam
Undefined                       first referenced
symbol                             in file
uncompress                          /usr/local/mysql/lib/libmysqlclient.a(my_compress.o)
compress                            /usr/local/mysql/lib/libmysqlclient.a(my_compress.o)
ld: fatal: Symbol referencing errors. No output written to proftpd
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `proftpd'
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP