在Linux下建立Telnet服务器

1.安装inetd

$ sudo apt-get install openbsd-inetd

2.安装xinetd 和 Telnet

$ sudo apt-get install xinetd telnet

3.配置telnet

$ sudo vim /etc/inetd.conf

输入:

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

$ sudo vim /etc/xinetd.conf

在#log_type = SYSLOG daemon info下面添加内容:

instances = 60   
log_type = SYSLOG authpriv   
log_on_success = HOST PID   
log_on_failure = HOST   
cps = 25 30  

# sudo vim /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   
}  


4.重启inetd服务,xinetd服务

$ sudo /etc/init.d/openbsd-inetd restart /etc/init.d/xinetd restart

5.查看telnet是否开启

$ sudo netstat -utlp

返回  ....*:telnet*.....    

6.试用一下

$ telnet localhost

正常返回

你可能感兴趣的:(Linux操作系统相关)