Tera Term Pro4.107および 5.0 系バージョンであれば下記の手順は不要です。まずは、Tera Termのバージョンをご確認ください。Tera Term Proが4.106以前のバージョンの場合、下記の手順をお試しください。
2022年6月時点にて、特定OSの初期状態では Tera Term でログインができない事象を確認しております。これは、OSのSSH サービスにて ssh-rsa がデフォルトで無効にされ、公開鍵認証 を利用した SSH アクセスができない事象となります。
暫定的に ssh-rsa を有効にして、インスタンスへTera TermでSSH接続できるようにする手順を下記にご案内しますので、ご参考ください。なお、下記手順に関する技術的なお問い合わせにつきましては、サポート対象外とさせていただきます。
(※)古い暗号化方式を適用させるため、セキュリティへの影響を検討のうえ本手順を実施してください。
■ 対象OS
Ubuntu 22.04
Ubuntu 24.04
CentOS Stream9
AlmaLinux 9.0
AlmaLinux 9.3
Rocky Linux 9.0
Rocky Linux 9.3
Debian 12
■手順
(1)Tera Term 以外の ssh 接続できるクライアント (Windows の PowerShell など) で接続します。
PowerShell の書式
> ssh -i 鍵ファイルのパス OS用の初期ユーザー名@IPアドレス
例 (Ubuntu の場合)
> 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)各OS毎のSSH サービスの設定を変更および再起動します。
下記のコマンドでroot権限に昇格します。
$ sudo su
<Ubuntu 22.04/24.04 の場合>
設定ファイルのバックアップを取得します。
# 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)
...
----------------------------------------------------------
<CentOS Stream9/AlmaLinux 9.0 の場合>
暗号化ポリシーの参照をします。
# update-crypto-policies --show
----------------------------------------------------------
DEFAULT
----------------------------------------------------------
暗号化ポリシーの変更をします。
# update-crypto-policies --set LEGACY
----------------------------------------------------------
Setting system policy to LEGACY
Note: System-wide crypto policies are applied on application start-up.
It is recommended to restart the system for the change of policies
to fully take place.
----------------------------------------------------------
暗号化ポリシーの変更を確認します。
# update-crypto-policies --show
----------------------------------------------------------
LEGACY
----------------------------------------------------------
OSの再起動を実施します。
# shutdown -r now
一般ユーザに変更します。
# exit
(3)Tera Term で鍵を指定してログインします。
作業は以上となります。