博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

一粒沙子的空间

   loveapple.cublog.cn
关于作者  
姓名:一粒沙子
职业:程序员
年龄:一般年龄
位置:北京
个性介绍:打工挣钱吃饭

我的分类  




debian下启动telnet服务
root@2[/]# apt-get install xinetd
正在读取软件包列表...
正在分析软件包的依赖关系树...
下列【新】软件包将被安装:
  xinetd
共升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
需要下载 0B/130kB 的软件包。
解压缩后会消耗掉 348kB 的额外空间。
Selecting previously deselected package xinetd.
(Reading database ... 65331 files and directories currently installed.)
Unpacking xinetd (from .../xinetd_1%3a2.3.13-2_i386.deb) ...
Setting up xinetd (2.3.13-2) ...
Starting internet superserver: xinetd.
Stopping internet superserver: xinetd.
Adding `diversion of /etc/init.d/inetd to /etc/init.d/inetd.real by xinetd'


root@2[/]# apt-get install telnetd
正在读取软件包列表...
正在分析软件包的依赖关系树...
下列【新】软件包将被安装:
  telnetd
共升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
需要下载 0B/40.6kB 的软件包。
解压缩后会消耗掉 139kB 的额外空间。
Selecting previously deselected package telnetd.
(Reading database ... 65337 files and directories currently installed.)
Unpacking telnetd (from .../telnetd_0.17-25_i386.deb) ...
Setting up telnetd (0.17-25) ...
--------- IMPORTANT INFORMATION FOR XINETD USERS ----------
The following line will be added to your /etc/inetd.conf file:

telnet          stream  tcp     nowait  telnetd.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.
-----------------------------------------------------------

新建一个文件/etc/xinetd.d/telnet,内容如下,并保存
root@2[/]# nano -w /etc/xinetd.d/telnet

  GNU nano 1.2.4             File: /etc/xinetd.d/telnet                        

# default: on

# description: The telnet server serves telnet sessions; it uses \

#       unencrypted username/password pairs for authentication.

service telnet

{

        disable = no

        flags           = REUSE

        socket_type     = stream

        wait            = no

        user            = root

        server          = /usr/sbin/in.telnetd

        server_args     = -h

        log_on_failure  += USERID



}

root@2[/]# apt-get install telnet
正在读取软件包列表...
正在分析软件包的依赖关系树...
下列【新】软件包将被安装:
  telnet
共升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
需要下载 63.8kB 的软件包。
解压缩后会消耗掉 188kB 的额外空间。
获取:1 http://mirrors.geekbone.org sid/main telnet 0.17-25 [63.8kB]
下载 53.0kB,耗时 4s (12.1kB/s)
Selecting previously deselected package telnet.
(Reading database ... 65349 files and directories currently installed.)
Unpacking telnet (from .../telnet_0.17-25_i386.deb) ...
Setting up telnet (0.17-25) ...


我们查看一下地址

root@2[/]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:10:A4:9F:2B:FF  
          inet addr:192.168.1.254  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::210:a4ff:fe9f:2bff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:106942 errors:0 dropped:0 overruns:0 frame:0
          TX packets:103319 errors:0 dropped:0 overruns:0 carrier:0
          collisions:9 txqueuelen:1000
          RX bytes:110201058 (105.0 MiB)  TX bytes:11096727 (10.5 MiB)
          Interrupt:11 Base address:0x4800

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4410 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4410 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1030232 (1006.0 KiB)  TX bytes:1030232 (1006.0 KiB)

我们现在来连接一下

root@2[/]# telnet 192.168.1.254
Trying 192.168.1.254...
Connected to 192.168.1.254.
Escape character is '^]'.
lcnja.8800.org login: root
Login incorrect

lcnja.8800.org login: lcnja
Password:
Last login: Mon Sep 27 20:51:33 2004 from localhost.localdomain on pts/3
Linux debian 2.6.8-1-686 #1 Tue Sep 14 00:22:58 EDT 2004 i686 GNU/Linux

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.
lcnja@lcnja:~$
从上面我们可以看到我们已经连接成功了,但是使用root连接的时候会失败,因为默认的安全设置是限制root用户使用telnet连接主机的


本来因为telnet是明文传输的,所以处于安全考虑才限制了root从telnet登陆,如果你需要使用,那么如下修改


root@2[/]# nano /etc/pam.d/login
#
# The PAM configuration file for the Shadow `login' service
#
# NOTE: If you use a session module (such as kerberos or NIS+)
# that retains persistent credentials (like key caches, etc), you
# need to enable the `CLOSE_SESSIONS' option in /etc/login.defs
# in order for login to stay around until after logout to call
# pam_close_session() and cleanup.
#

# Outputs an issue file prior to each login prompt (Replaces the
# ISSUE_FILE option from login.defs). Uncomment for use
# auth       required   pam_issue.so issue=/etc/issue

# Disallows root logins except on tty's listed in /etc/securetty
# (Replaces the `CONSOLE' setting from login.defs)
#把下面在行注释掉
# auth       requisite  pam_securetty.so

# Disallows other than root logins when /etc/nologin exists
# (Replaces the `NOLOGINS_FILE' option from login.defs)
auth       requisite  pam_nologin.so

# This module parses /etc/environment (the standard for setting
# environ vars) and also allows you to use an extended config
# file /etc/security/pam_env.conf.
# (Replaces the `ENVIRON_FILE' setting from login.defs)
auth       required   pam_env.so

# Standard Un*x authentication. The "nullok" line allows passwordless
# accounts.
@include common-auth

# This allows certain extra groups to be granted to a user
# based on things like time of day, tty, service, and user.
# Please uncomment and edit /etc/security/group.conf if you
# wish to use this.
# (Replaces the `CONSOLE_GROUPS' option in login.defs)
# auth       optional   pam_group.so

# Uncomment and edit /etc/security/time.conf if you n

好,现在一个telnet我们就在debian下面架设好了,当然最后一步本人不建议你做

因为telnet是内镶在xinetd这个服务里面的,所以如果你要启动或者是要停止该服务就要
root@2[/]# /etc/init.d/xinetd
force-reload  reload        restart       start         stop
看上面的自己选择

 原文地址 http://blog.itzero.com/html/02/viewthread_tid_54302.html
 发表于: 2007-07-06,修改于: 2007-07-06 09:32 已浏览583次,有评论0条 推荐 投诉

  网友评论

  发表评论



Copyright © 2001-2006 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们
页面生成时间:0.0072

京ICP证041476号