LoginSignup
2
0

ubuntu 22.04でssh接続できなくなった時

Last updated at Posted at 2022-06-02

ubuntu 22.04からssh version 8.8に上がったためいくつか接続するために修正が必要だった。
自分は以下の方法で解決した。

rsaを許可する

対象のサーバーのsshd_configにrsaを許可する

  • /etc/ssh/sshd_config
sshd_config
HostKeyAlgorithms=+ssh-rsa
PubkeyAcceptedAlgorithms=+ssh-rsa
  • sshdを再起動する
systemctl restart ssh

古い鍵で動いているサーバーへの接続

OpenSSH version 8.8 から古い鍵で動いているサーバーへの接続が許可されなくなった様子。

強制的に許可をする場合は以下記述することでまた接続できるようになる。

~/.ssh/config
Host *
    HostKeyAlgorithms ssh-dss,ssh-rsa
    PubkeyAcceptedKeyTypes ssh-dss,ssh-rsa

新しい鍵の場合

~/.ssh/config
Host *
    HostKeyAlgorithms rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
    PubkeyAcceptedKeyTypes rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519

ssh 接続時のアドレスに IPv4 のみを使うようにする

~/.ssh/config
Host *
    AddressFamily inet
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0