1. sudo apt-get install xinetd telnetd
sudo vi /etc/inetd.conf並加入以下一行,假如沒有發現這個文件,自己新建立一個也是可以的哦,剛開始我也不知道,自己試了之後才知道的。
telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd
(紅色字體部分可不需要)
3. sudo vi /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
4. sudo vi /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
log_on_failure += USERID
}
5. 重啓機器或重啓網絡服務sudo /etc/init.d/xinetd restart
注:linux 下的telnet服務爲了安全,默認情況下是不允許root登錄的
如果要使root可登錄,修改vi /etc/securetty,加入:
pts/0
pts/1
pts/2
pts/3
如果登錄的用戶比較多,可能需要更多的pts/*
這樣添加的作用是允許root從pts/0到pts/3這幾個終端登錄linux
保存後,重啓服務service xinetd restart
之後就可以使用root登錄linux了。