Ubuntu 20.04 LTSサーバにtelnetデーモンをインストールしてtelnetにサーバへログインする手順を紹介します。
※リモートでログインするの方法としてSSHがあります。SSHは通信中のパケットを暗号化されているのでSSHが利用できるのであれば、telnetではなくSSHをお勧めします。
インストール環境
- 20.04.3 LTS (Focal Fossa)
 
telnetd インストール
| 
					 1  | 
						sudo apt install telnetd  | 
					
inetdの起動確認
今回インストールしたtelnetdはサービスを受けるけるのにinetd(スーパーデーモン)を利用する形になります。TCP23の待ち受けはinetdが実施し、実際にパケットが来たタイミングでinetdがtelnetdを起動する仕組みになっています。したがって、telnetdのデーモンではなくinetdが起動している状態を確認する。
inetdのデーモン状態
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14  | 
						test@test01-ubuntu2004:~$ sudo systemctl status inetd ● inetd.service - Internet superserver      Loaded: loaded (/lib/systemd/system/inetd.service; enabled; vendor preset: enabled)      Active: active (running) since Sun 2022-01-09 00:08:16 UTC; 6min ago        Docs: man:inetd(8)    Main PID: 32351 (inetd)       Tasks: 1 (limit: 2274)      Memory: 788.0K      CGroup: /system.slice/inetd.service              └─32351 /usr/sbin/inetd Jan 09 00:08:16 test01-ubuntu2004 systemd[1]: Starting Internet superserver... Jan 09 00:08:16 test01-ubuntu2004 systemd[1]: Started Internet superserver. test@test01-ubuntu2004:~$  | 
					
Active: active の状態でinetdが起動しています。
/etc/inetd.conf 設定ファイル
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41  | 
						test@test01-ubuntu2004:~$ cat /etc/inetd.conf # /etc/inetd.conf:  see inetd(8) for further informations. # # Internet superserver configuration database # # # Lines starting with "#:LABEL:" or "#<off>#" should not # be changed unless you know what you are doing! # # If you want to disable an entry so it isn't touched during # package updates just comment it out with a single '#' character. # # Packages should modify this file by using update-inetd(8) # # <service_name> <sock_type> <proto> <flags> <user> <server_path> <args> # #:INTERNAL: Internal services #discard                stream  tcp     nowait  root    internal #discard                dgram   udp     wait    root    internal #daytime                stream  tcp     nowait  root    internal #time           stream  tcp     nowait  root    internal #:STANDARD: These are standard services. telnet          stream  tcp     nowait  telnetd /usr/sbin/tcpd  /usr/sbin/in.telnetd #:BSD: Shell, login, exec and talk are BSD protocols. #:MAIL: Mail, news and uucp services. #:INFO: Info services #:BOOT: TFTP service is provided primarily for booting.  Most sites #       run this only on machines acting as "boot servers." #:RPC: RPC based services #:HAM-RADIO: amateur-radio services #:OTHER: Other services test@test01-ubuntu2004:~$  | 
					
inetdが受け付けるサービスを設定するのが /etc/inetd.conf になる。24行目が telnet を待ち受ける設定になる。telnetの待ち受けを停止する場合は 該当行をコメント(行頭に#)に変更すれば inetdでのtelnetの受付を停止することができる。
telnetの動作確認
今回 telnet サーバーを設定したIPアドレスは 172.28.3.1 での例となります。
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  | 
						test@test00-ubuntu2004:~$ telnet 172.28.3.1 Trying 172.28.3.1... Connected to 172.28.3.1. Escape character is '^]'. Ubuntu 20.04.3 LTS test01-ubuntu2004 login: test Password: Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-92-generic x86_64)  * Documentation:  https://help.ubuntu.com  * Management:     https://landscape.canonical.com  * Support:        https://ubuntu.com/advantage   System information as of Sun 09 Jan 2022 12:21:04 AM UTC   System load:  0.0                Processes:               214   Usage of /:   17.1% of 28.42GB   Users logged in:         1   Memory usage: 13%                IPv4 address for ens160: 172.28.3.1   Swap usage:   0%  * Super-optimized for small spaces - read how we shrank the memory    footprint of MicroK8s to make it the smallest full K8s around.    https://ubuntu.com/blog/microk8s-memory-optimisation 0 updates can be applied immediately. Last login: Sun Jan  9 00:20:28 UTC 2022 from 172.27.1.1 on pts/0 test@test01-ubuntu2004:~$  | 
					
スポンサーリンク
Ubuntu 20.04 LTS Server 記事一覧
Ubuntu 20.04 LTS Server インストール
Ubuntu 20.04 LTS Server 設定記事一覧
- タイムゾーンを日本時間(JST)に変更
 - ネットワークの設定 ( IPv4アドレス、DNS(resolve) 、デフォルトゲートウェイ、static route )
 - シリアルからコンソールに接続する設定
 - ファイアウォール ufw の設定方法