Ubuntu 22.04 LTSの SSH サービスにて ssh-rsa はデフォルトで無効にされたため、
2022年4月28日時点での Tera Term で 公開鍵認証 を利用した SSH アクセスができない事象を
確認しております。
暫定的に ssh-rsa を有効にして、Ubuntu 22.04 LTSのインスタンスへTera TermでSSH接続できるように
する手順を下記にご案内しますので、ご参考ください。なお、下記手順に関する技術的なお問い合わせにつきましては、サポート対象外とさせていただきます。
■ 参考URL
https://ja.osdn.net/projects/ttssh2/ticket/36109
■ 手順
(1)Tera Term 以外の ssh 接続できるクライアント (Windows の PowerShell など) で接続します。
PowerShell の書式
> ssh -i 鍵ファイルのパス ubuntu@IPアドレス
例
> ssh -i C:\Users\hogehoge\Documents\private_key.txt ubuntu@192.168.1.1
---------------------------------------
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
ECDSA key fingerprint is SHA256:gayL1ESEnTe6tOQD5HU6Xtjt8mYI8hz0jvCC7l10Bfk.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes << ★ yes を入力 ★
Warning: Permanently added '192.168.1.1' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.15.0-25-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Wed Apr 27 10:49:23 UTC 2022
System load: 0.57958984375 Processes: 114
Usage of /: 3.8% of 38.60GB Users logged in: 0
Memory usage: 12% IPv4 address for ens10: 192.168.1.1
Swap usage: 0%
0 updates can be applied immediately.
(2)SSH サービスの設定を変更および再起動します。
下記のコマンドでroot権限に昇格します。
$ sudo su
設定ファイルのバックアップを取得します。
# cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config.backup
設定ファイルを変更します。
# sed -i '1s/^/PubkeyAcceptedAlgorithms=+ssh-rsa\n/' /etc/ssh/sshd_config
サービスの再起動をします。
# systemctl restart ssh.service
サービスの確認をします。
# systemctl status ssh.service
----------------------------------------------------------
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-04-27 10:52:09 UTC; 11s ago << ★ 再起動していることを確認 ★
Docs: man:sshd(8)
man:sshd_config(5)
Process: 1799 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 1800 (sshd)
Tasks: 3 (limit: 2327)
一般ユーザに変更します。
# exit
(3)Tera Term で鍵を指定してログインします。