debian下telnet服务器配置

来源:互联网 发布:power dos安装windows 编辑:程序博客网 时间:2024/06/04 18:18

1.:/etc# find / -name telnet 搜索后发现只有下面几个关于telnet的文件
/usr/bin/telnet
/usr/share/doc/telnet
/usr/share/menu/telnet
/etc/alternatives/telnet
/var/lib/dpkg/alternatives/telnet

2. 输入命令apt-get install xinetd telnetd安装telnet服务

安装过程如下

:/etc# apt-get install xinetd telnetd
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包将被【卸载】:
  openbsd-inetd
下列【新】软件包将被安装:
  telnetd xinetd
共升级了 0 个软件包,新安装了 2 个软件包,要卸载 1 个软件包,有 230 个软件未被升级。
需要下载 178kB 的软件包。
解压缩后会消耗掉 287kB 的额外空间。
您希望继续执行吗?[Y/n]r
中止执行。
debian-panhx-2:/etc# apt-get install xinetd telnetd
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包将被【卸载】:
  openbsd-inetd
下列【新】软件包将被安装:
  telnetd xinetd
共升级了 0 个软件包,新安装了 2 个软件包,要卸载 1 个软件包,有 230 个软件未被升级。
需要下载 178kB 的软件包。
解压缩后会消耗掉 287kB 的额外空间。
您希望继续执行吗?[Y/n]Y
获取:1 http://ftp.sjtu.edu.cn lenny/main xinetd 1:2.3.14-7 [136kB]
获取:2 http://ftp.sjtu.edu.cn lenny/main telnetd 0.17-36 [42.3kB]
下载 178kB,耗时 1s (144kB/s)
(正在读取数据库 ... 系统当前总共安装有 119456 个文件和目录。)
正在删除 openbsd-inetd ...
Stopping internet superserver: inetd.
正在处理用于 man-db 的触发器...
选中了曾被取消选择的软件包 xinetd。
(正在读取数据库 ... 系统当前总共安装有 119450 个文件和目录。)
正在解压缩 xinetd (从 .../xinetd_1%3a2.3.14-7_i386.deb) ...
选中了曾被取消选择的软件包 telnetd。
正在解压缩 telnetd (从 .../telnetd_0.17-36_i386.deb) ...
正在处理用于 man-db 的触发器...
正在设置 xinetd (1:2.3.14-7) ...
Stopping internet superserver: xinetd.
Starting internet superserver: xinetd.
正在设置 telnetd (0.17-36) ...
正在将用户“telnetd”加入到“utmp”组中
--------- IMPORTANT INFORMATION FOR XINETD USERS ----------
The following line will be added to your /etc/inetd.conf file:

telnet          stream  tcp     nowait  telnetd /usr/sbin/tcpd  /usr/sbin/in.telnetd

If you are indeed using xinetd, you will have to convert the
above into /etc/xinetd.conf format, and add it manually. See
/usr/share/doc/xinetd/README.Debian for more information.
Suggested entry (automatically converted using itox):

service telnet
{
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = telnetd
You must use option -daemon_dir if you use tcpd
-----------------------------------------------------------

 

3.修改/etc/xinetd.conf

如下:
defaults
{
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
includedir /etc/xinetd.d


4.在目录/etc/xinetd.d/新增telnet文件内容如下

service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}


5.重启服务

:/etc/xinetd.d# /etc/init.d/xinetd restart
Stopping internet superserver: xinetd.
Starting internet superserver: xinetd.

 

6.在本机和远程机上测试

 login:***

Password:
Last login: Tue Dec 14 17:32:46 CST 2010 on :0
Linux debian-panhx-2 2.6.26-2-686 #1 SMP Wed Aug 19 06:06:52 UTC 2009 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.

不过使用telnet,root用户不能直接登录,需要登录上去后切换。

 

 

 

关于欢迎字符的修改,转录http://blog.csdn.net/lonelystar007/archive/2007/05/13/1607337.aspx

telnet登录上去的时候系统提示:Ubuntu 5.10 "Breezy Badger localhost.localdomain觉得太傻了。。怎么修改呢,man了一下telnetd,她告诉我修改/etc/issue.net就可以了。。
vi /etc/issue.net
里面只有一句:Ubuntu 5.10 "Breezy Badger" %h,研究一下转义字符
man issue.net
很快便有了答案:
%t - show the current tty
%h - show the system node name (FQDN)
- show the name of the NIS domain
%d - show the current time and date
%s - show the name of the operating system
%m - show the machine (hardware) type
%r - show the operating system release
%v - show the operating system version
%% - display a single ’%’ characte

于是我依样画葫芦写了一个:
Hi, Welcome to Login MYSUN.ORG Server! Now, You're at the no.%t tty,
The current time and date on this server is: %d