一、安装openbsd-inetd软件包。
sudo apt-get install openbsd-inetd -y
二、安装telnetd服务。
sudo apt-get install telnetd -y
三、查看运行状态。
sudo netstat -a | grep telnet
ms@ubuntu:~$ sudo netstat -a | grep telnet
tcp 0 0 0.0.0.0:telnet 0.0.0.0:* LISTEN
tcp 0 0 ubuntu:telnet 198.168.1.201:56007 ESTABLISHED
四、本机登录与远程登录测试。
s@ubuntu:~$ telnet 127.0.0.1
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Ubuntu 20.04.1 LTS
ubuntu login: ms
Password:
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-52-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
0 updates can be installed immediately.
0 of these updates are security updates.
Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Sat Oct 31 21:42:02 CST 2020 from localhost on pts/3
ms@ubuntu:~$
Ubuntu 20.04.1 LTS
ubuntu login: ms
Password:
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-52-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
0 updates can be installed immediately.
0 of these updates are security updates.
Your Hardware Enablement Stack (HWE) is supported until April 2025.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
-bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.UTF-8)
五、若登录失败,重启openbsd-inetd服务或系统。
sudo /etc/init.d/openbsd-inetd restart
ms@ubuntu:~$ sudo /etc/init.d/openbsd-inetd restart
Restarting openbsd-inetd (via systemctl): openbsd-inetd.service.
ms@ubuntu:~$
sudo reboot