telnet是一种网络通信协议,我们可以使用它登录远程服务器,Ubuntu安装后默认只有telnet客户端,即只能在Ubuntu内去连接其他telnet服务器,本文将详细介绍在Ubuntu下安装部署telnet服务端,以便实现其他客户端使用telnet协议远程登录Ubuntu服务器。
环境:Ubuntu14.04
1.首先以root权限运行apt-get install xinetd,普通用户的执行命令是sudo apt-get install xinetd
mm@ubuntu:/media/mm/f019bb83-2870-44f4-a660-ff154efa1bee/linux_6ul/new_imx6ul/yanshou$ sudo apt install xinetd
sudo: /etc/sudoers.d is world writable
Reading package lists... Done
Building dependency tree
Reading state information... Done
xinetd is already the newest version.
The following packages were automatically installed and are no longer required:
libdbusmenu-gtk4 libqpdf13
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
2.接着运行以root权限apt-get install telnet,普通用户的执行命令是sudo apt-get install telnet
mm@ubuntu:/media/mm/f019bb83-2870-44f4-a660-ff154efa1bee/linux_6ul/new_imx6ul/yanshou$ sudo apt install telnetd
sudo: /etc/sudoers.d is world writable
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libdbusmenu-gtk4 libqpdf13
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
telnetd
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 40.1 kB of archives.
After this operation, 127 kB of additional disk space will be used.
Get:1 http://ubuntu.cn99.com/ubuntu/ trusty/universe telnetd amd64 0.17-36build2 [40.1 kB]
Fetched 40.1 kB in 0s (183 kB/s)
Selecting previously unselected package telnetd.
(Reading database ... 217199 files and directories currently installed.)
Preparing to unpack .../telnetd_0.17-36build2_amd64.deb ...
Unpacking telnetd (0.17-36build2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up telnetd (0.17-36build2) ...
Adding user telnetd to group utmp
Note: xinetd currently is not fully supported by update-inetd.
Please consult /usr/share/doc/xinetd/README.Debian and itox(8).
3.新建telnet文件,并将其拷到/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
}
-
新建xinetd.conf文件,并将其拷到/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 instance = 60 log_type = SYSLOG authpriv log_on_success = HOST PID log_on_failure = HOST cps = 25 30 } includedir /etc/xinetd.d
5.运行/etc/init.d/xinetd restart(root权限)
运行 sudo /etc/init.d/xinetd restart(一般用户)重启服务,查看到进程号即已开启
sudo: /etc/sudoers.d is world writable
xinetd stop/waiting
xinetd start/running, process 72468
6.客户端使用telnet 192.168.1.XX连接,输入账号密码即可。