您的位置:首页 > 其它

ubuntu下telnet安装

2016-05-16 21:56 453 查看
系统默认安装了telnet(client),所以只能用telnet登录别人开启telnet服务的主机,其他人是不能telnet登录本机的。

现在想要的是让别人可以使用telnet登录本机,需要安装两个软件:

xintd,telnetd

其中telnetd是telnet-server,但它是无法自我启动的,需要管理daemon软件xinetd来接管。

1. 安装xinetd和telnetd

$sodu apt-get install xinetd telnetd

2. 配置文件

A. /etc/inetd.conf

$ cat /etc/inetd.conf (如果存在就不需要了)

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

B. 修改/etc/xinetd.conf

$ sudo gedit /etc/xinetd.conf
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{

# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info(插入红色部分)
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}

includedir /etc/xinetd.d

C. 修改/etc/xinetd.d/telnet

$ sudo gedit /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      #in.telnetd是telnetd安装文件
log_on_failure += USERID
}

3. 重启机器或重启网络服务

$ sudo /etc/init.d/xinetd restart

4. 使用TELNET客户端远程登录;ifconfig -a显示本机地址;
可以确定telnet服务器已经搭建完成,这时只需要换个电脑,然后使用telnet ip即可登录。
默认的设定是root不能通过telnet登录(telnet在网络上是明文传输,可以被sniffer侦测出密码),如果安全性有保证,可以通过一下方法允许root登录

(1)修改/etc/securetty文件,添加终端
    root@kristain_desktop:~# tail -5 /etc/securetty
    pts/0
    pts/1
    pts/2
    pts/3
    pts/4 或者直接将securetty文件改名,即可使用root登录

(2)修改/etc/pam.d/login文件,将securetty验证注释调
# Disallows root logins except on tty's listed in /etc/securetty     
# (Replaces the `CONSOLE' setting from login.defs)
# Note that it is included as a "required" module. root will be
# prompted for a password on insecure ttys.
# If you change it to a "requisite" module, make sure this does not leak
# user name information.
#auth       required  pam_securetty.so
这样telnet基本上就配置完成了,不过还是建议大家用ssh .

转自:http://www.cnblogs.com/kristain/articles/2590238.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: