免费注册 查看新帖 |

Chinaunix

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

fc4安装配置vsftp [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-28 20:46 |只看该作者 |倒序浏览

fc4安装配置vsftp
tju_darksun 发表于 2005-11-7 21:30:00
原文发表在linux@bbs.tju.edu.cn
安装很简单,据说从rh9开始就自带vsftp了,配置比较麻烦的说。
http://cn.tech.yahoo.com/050531/551/26zxo.html

这篇文章应该是作者翻译man vsftp的吧,开始照着这个配置,可以很快的设置简单的ftp,可以匿名登陆,默认文件夹应该是/pub
但是匿名登陆不是很安全,怎么不安全我也不知道,于是禁止匿名登陆,参数见链接文章。用户登陆可以通过两种方法实现,一种是本机帐号登陆,一种是虚拟帐号登陆,本机帐号非常好实现,直接改参数即可,功能也很齐全,引用篇文章。
http://linux.chinaunix.net/doc/netconf/2005-01-10/722.shtml

比前一篇写的全多了。而且介绍了如何限速,但是我安装的时候没有测试,不能保证这个功能能否实现。(man手册里也没有这个功能)文章还介绍了虚拟用户的使用(仅能登陆ftp,不能用作本地帐号)这个实现起来出了很多错误。
主要通过这样的方法实现。
建立一个专门虚拟帐号,比如virtualus
然后将ftp用登陆帐号映射(可能用词不当,但是就是这个意思)到这个帐号,而且ftp帐号
其密码是加密过的,PAM配置,上面的文章通过
1.生成虚拟用户口令库文件。为了建立此口令库文件,先要生成一个文本文件。该文件
的格式如下,单数行为用户名,偶数行为口令:
#vi account.txt
ylg
1234
zhanghong
4321
gou
5678
2.生成口令库文件,并修改其权限:
#db_load -T -t hash -f ./account.txt /etc/vsftpd/account.db
#chmod 600 /etc/vsftpd/account.db
3.新建一个虚拟用户的PAM文件。加上如下两行内容:
#vi /etc/pam.d/vsftp.vu
auth required /lib/security/pam_userdb.so db=/etc/vsftpd/account
account required /lib/security/pam_userdb.so db=/etc/vsftpd/account
4.建立虚拟用户,设置该用户所要访问的目录,并设置虚拟用户访问的权限:
#useradd -d /ftpsite virtualus
#chmod 700 /ftpsite
并在vsftpd.conf加入
guest_enable=YES
guest_username=virtual_user
pam_service_name=vsftp.vu
实现,但是照做后测试登陆显示500 OOPS: priv_sock_get_result
google之,搜索到类似英文问题,安装环境同我完全一样,窃喜。
http://kerneltrap.org/node/5830

他的问题如下
i want to add some virtual user into my FTP server,but...
my system is FC4 2.6.11 , db4 , vsftpd-2.0.3, already set SELINUX=disabled
my configure:
1)
#vi virtualus.txt
linux
123456
tt
123
2)
#db_load -T -t hash -f ./virtualus.txt /etc/vsftpd/vsftpd_login.db
#chmod 600 /etc/vsftpd/vsftpd_login.db
3)add virtual_user
#useradd -d /ftpsite virtualus
#chmod 700 /ftpsite
4)pam
#cat /etc/pam.d/vsftpd
auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
5)my configure at /etc/vsftpd/vsftpd.conf
#cat /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=NO
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
pam_service_name=vsftpd
connect_from_port_20=YES
ftpd_banner=Welcome to S_ FTP server.
listen=YES
listen_port=2121
one_process_model=NO
chroot_local_user=YES
guest_enable=YES
guest_username=virtualus
6)
#service vsftpd restart
连接出错和我一样,回贴中有人推荐了类似的文章,是gentoo环境下安装vsftp的
http://forums.gentoo.org/viewtopic-t-302850-start-14-postdays-0-postorder-asc-highlight-.html

还有一个被我忽略的很重要的回贴
yeah, but you must answer some questions:
1. does your FC4 have pam_pwdfile?
(_should_ be located in /lib/security/)
if not, here's the homepage, where you can get the source
http://cpbotha.net/pam_pwdfile.html

2. where're your vsftp.conf? (look in /etc, /etc/vsftpd, ...)?
3. do you have the /etc/pam.d/ directory?
因为选择了全部安装,就把这个回贴忽略了,pam_pwdfile.so应该是必须的一个文件
直接去看一老外将gentoo环境下的方法移殖过来的贴子
Well, I should have tell you this sooner, but "portage" is gentoo's package management (like RPM for Red Hat)... so you can skip the first step...
so, go directly to: "Previously, vsftpd used the file /etc/pam.d/vsftpd [...]".. so, the next thing you've to do is modifying the "/etc/pam.d/vsftpd" file to:
auth required pam_pwdfile.so pwdfile /etc/vsftpd/passwd_ftp
account required pam_permit.so
now, change the layout of "virtualus.txt"
linux
123456
tt
123
to:
linux:123456
tt:123
then put the perl-script into "filter.pl"
#! /usr/bin/perl -w
use strict;
# filter "user:cleartext" lines into "user:md5_crypted"
# probably requires glibc
[...]
(Take the script out of the How To, since kerneltrap's posting system sometimes cut things out!!!)
now, you can generate the access control list "passwd_ftp" with
perl filter.pl ./virtualus.txt > /etc/vsftpd/passwd_ftp
其实就是把登陆帐号的口令库文件换了一种加密方式?我是这么理解的
照着把我原来的修改,依然不行,于是我重复了老外的所有步骤,连配置文件都照着copy
老外是
haha^_^
Comment posted by tubies on Sunday, October 30, 2005 - 22:03
ok!ok!Now i can use the virtual user to enter my ftp server.
thank you so so much.
我看这句话心都碎了-_-,然后仔细检查才发现自己没有pam_pwdfile.so文件,下载,安装,题外话,这个安装没有 configure,结果照着他的INSTALL文件又下了个什么LINUX-PAM-0.75才把这个装上,看来全部安装还是装的不全,linux还是要储存网络生存的。
弄好了,测试,终于ok。于是找人测试,因为使用路由器上网,外网登陆可以验证用户名和密码,但是不能list,卡在了PASV那,应该是被动传输使用其他端口的问题,搜索文章,搜到了这个。
http://www.uplinux.com/www/net/02/107.shtml

里面都是一些稍微高级的技巧,尝试把
Pasv_min_port=50000 (将客户端的数据连接端口改在
Pasv_max_port=60000  50000—60000之间)
把数的范围改小,然后分别在路由器上做端口映射(那个什么DMZ主机跟本不管用)
结果出现vsftpd dead but subsys locked错误
再google,中文解释方法是将vsftpd.conf删掉或将vsftp缷载然后重新装,失败,
另一种方法是将配置文件每一行都注释掉,将上面Pasv*****注释掉以后正常运行,
又测试了一些所谓的高级参数,发现都不能使ftp正常运行
所以还不能完全相信网上搜来的答案,放弃,如果不用路由器现在已经成功了。
到此弄了一天了,虽然没有开成ftp,但是操作熟悉了不少,google也熟悉了不少,
关于权限问题引用的文章里都有介绍,其中尤其推荐
http://linux.chinaunix.net/doc/netconf/2005-01-10/722.shtml

用Linux构建最好的FTP服务器
后记:是防火墙的问题,关闭防火墙后问题解决,端口的参数问题是大小写的问题-_-,
全小写就ok。
最后pasv_min_port=50000
pasv_max_port=60000
开启防火墙,正常运用。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/19772/showart_133980.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP