sshで、公開鍵認証でアクセスしていたサーバに突然パスワードを要求される。
原因
接続先のホームディレクトリのパーミッションがおかしくなってた。
対処
接続先のホームディレクトリのパーミッションを0755 -> 0705に。
その他
接続先の ~
, ~/.ssh
, ~/.ssh/authorized_keys
あたりを確認すること。どのパーミッションにすべきかはman sshd
に書いてあるが、ホームディレクトリに関しては書いていない……。
~/.ssh/ This directory is the default location for all user-specific configuration and authentication information. There is no general requirement to keep the entire contents of this directory secret, but the recommended permissions are read/write/execute for the user, and not accessible by others. ~/.ssh/authorized_keys Lists the public keys (RSA/DSA) that can be used for logging in as this user. The format of this file is described above. The content of the file is not highly sensitive, but the recom- mended permissions are read/write for the user, and not accessible by others.
また、接続元の各ディレクトリ・ファイルのパーミッションの設定ミスでも問題が起きることがある。こちらはエラーがもっとわかりやすいので大抵すぐわかるだろうが。