由 闪光 在 08-29-2002 18:02 发表:
ftp服务器
我用的是RH7.3,经简单设置后,测试出现如下情况:
[root@localhost root]# ftp 192.168.0.250
ftp: connect: Connection refused
ftp> open 127.0.0.1
ftp: connect: Connection refused
ftp>
[root@localhost root]# ckconfig
Checking _PATH_FTPUSERS :: /etc/ftpusers
ok.
Checking _PATH_FTPSERVERS :: /etc/ftpservers
I can't find it... look in doc/examples for an example.
Checking _PATH_FTPACCESS :: /etc/ftpaccess
ok.
Checking _PATH_PIDNAMES :: /var/run/ftp.pids-%s
ok.
Checking _PATH_CVT :: /etc/ftpconversions
ok.
Checking _PATH_XFERLOG :: /var/log/xferlog
ok.
Checking _PATH_PRIVATE :: /etc/ftpgroups
ok.
Checking _PATH_FTPHOSTS :: /etc/ftphosts
ok.
[root@localhost root]#
可我却不知是哪错了,另外/etc/ftpservers文件该如何配制呀?
由 北南南北 在 08-29-2002 21:55 发表:
设定FTP[转帖]作者:captain
wu-ftpd
限制 user 只能在 home directory 底下活动 一个 IP 只允许一个 connection
/etc/ftpaccess :
class all real,guest,anonymous *
class : 定义存取类别用字
all : 定义出的类别名称
real : 真实使用者名称
guest : guest(访客) 帐号
anonymous : 匿名使用者名称
- : 接受任何 ip or Domain
(or .ictc1.com.tw 192.168.0. : 只有 ictc1.com.tw 或 192.168.0 才可以)
建议改成 class all real ictc1.com.tw
email root@localhost : ftp 信息通知的 e-mail account
loginfail 3 : 登入错误最多次数,建议改小一点
message /welcome.msg login 进站画面档
compress yes all
tar yes all
压缩权限定义
chmod no guest,anonymous
delete no guest,anonymous
overwrite no guest,anonymous
指令权限定义
....................
login transfer all inbound,outbound
all 类别的使用者上下传纪录 log
passwd-check rfc822 warn
登入检查
none 不检查
trivial 密码中需有 @
rfc822 密码需符合 RFC822 文件的规定
处理方式
warn 只警告,一样可以登入
enforce 拒绝使用者登入
deny 192.168.0.1 /etc/deny.msg
deny *.ictc1.com.tw /etc/deny.msg
deny c1.* /etc/deny.msg
拒绝 192.168.0.1 ; ictc1.com.tw ; c1 的主机登入,并显示 /etc/deny.msg
limit all 10 Any /etc/limit.msg
限制类别 all 的使用者在任何时间(注意大小写)可以同时登入最多人数,超过时显示 /etc/limit.msg
如果不加的话是没有联机限制的!!
alias pub /pub
设定上传档案目录
cdpath /pub
设定 search 路径
upload /var/ftp /pub yes guest guest 0777 dirs
/var/ftp : 登入时的根目录
/pub : 相对于根目录的子目录
yes : 可以上传档案
guest : 上传档案的 owner
guest : 上传档案的 group
dirs : 可以建立子目录 ( nodirs : 不可建立)
shutdown /etc/shutmsg
2001 02 20 21 30 0010 0005
System shutdown at %s : 显示给使用者的讯息,及关机时间
ftp server 将于 2001/02/20 21:30 关闭,关闭前 10 mins 禁止进入,关闭前 5 mins 会踢出所有使用者
ps.也可以用 ftpshut 指令直接关闭 ftp server
ftpshut [-ln][dn] time [message]
-ln : 关闭前 n mins , 禁止进入
-d : 关闭前 n mins , 开始将使用者踢出
time : 关闭时间 , now 为马上
message : 关闭的提示讯息(以" " 括起来)
ex: ftpshut -l10 -d3 2330 "ftp server 将于 23:30 关闭"
只要将 /etc/shutmsg 删除即可继续服务
ftpwho : 可以用来检视登入的使用者
/etc/ftpconversions : 定义压缩程序
/etc/ftphosts : 定义禁止进入的主机
/etc/ftpusers : 定义禁止进入的使用者
/etc/ftpgroups : 定义禁止进入的群组
--------------------------------------------------------------------------------
如何限制 user 只能在 home directory 底下活动 :
/etc/ftpaccess
guest-root /home *
restricted-uid *
--------------------------------------------------------------------------------
一个 IP 只允许一个 connection
有两种做法
方法一
vi /etc/xinetd.d/wu-ftpd
default: on
description: The wu-ftpd FTP server serves FTP connections. It uses \
normal, unencrypted usernames and passwords for authentication.
service ftp
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.ftpd
server_args = -l -a
log_on_success += DURATION USERID
log_on_failure += USERID
nice = 10
加入这行
per_source = 1
}
然后重新激活 xinetd 就可以了
/etc/rc.d/init.d/xinetd restart
这个时候如果同一个 IP 有第二个 connection 要 ftp 进来,则 client 端会看到
Connected to 192.168.0.220.
421 Service not available, remote server has closed connection
ftp>
而 FTP Server 会看到 /var/log/secure
Jan 11 16:46:35 testing xinetd[25873]: START: ftp pid=26016 from=192.168.0.220
Jan 11 16:46:43 testing xinetd[25873]: FAIL: ftp per_source_limit from=192.168.0.220
第一行是成功 login 的讯息,第二行就是 error message 了!!
方法二
另外一种用原本 wu-ftp 的功能,那就是改 /etc/ftpaccess
vi /etc/ftpaccess
在最后加入一行
host-limit all 1 Any message
其中 all 是 class name,您可以依据您的 class name 而修改!!
重新激活 ftp 后就可以了
/etc/rc.d/init.d/xinetd restart
不过 error message 却不太一样,用这个方法在 client 端会看到
Connected to 19