答:这是因为telnetd/ftpd是用tcpd来启动的,而tcpd要进行安全性检查,而它使用反向名字解析。
你可以把客户机的IP地址/名字加到/etc/hosts中或加到DNS里。
另一种办法是取消tcpd(不推荐),修改/etc/inetd.conf
将原来的:
ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
改为:
ftp stream tcp nowait root /usr/sbin/in.ftpd in.ftpd -l -a
原来的:
telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd
改为: telnet stream tcp nowait root /usr/sbin/in.telnetd in.telnetd
改完之后用killall -HUP inetd即可生效。
问:如何禁止某个用户的telnet功能,同时它有ftp功能?
答:假设你想把用户ftponly的telnet关掉,
1)写一个shell script /bin/ftponly:
#!/bin/sh
/bin/cat << XX
You can only use FTP on this computer,
but you may not use this account to login.
Connection will be closed in 10 seconds.
XX
/usr/bin/sleep 10
#end of ftponly
这里的XX是个标志,当ftponly试图telnet的时候,屏幕上将显示两个XX之间的内容,
然后10秒以后切断connect。注:还应该用trap来屏蔽键盘中断吧!否则人家用Ctrl-Z......
2)把用户ftponly的shell设置成/bin/ftponly:到passwd文件,找到对应于ftponly的那行:
ftponly:......:/home/ftponly:/bin/bash
把最后的/bin/bash改为/bin/ftponly.