LoginSignup
15
14

More than 5 years have passed since last update.

ssh ログイン 出来なくてハマって調べた事例集

Posted at

新しいユーザーを作って鍵認証ログインが出来なかったりしたら、このあたりを調べればまぁ大体わかるんじゃないかって話し。

結論

全部対応したとおもったのに、ログイン出来なかったら/var/log/auth.log を見よう

調べた事

  • ~/.ssh/ のパーミッション700
  • ~/.ssh/authorized_keys のパーミッション600
  • /etc/ssh/sshd_config の設定
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      %h/.ssh/authorized_keys
  • keyが一致しているか(他の鯖に置いて試してみるとか)
  • 違うユーザーのkeyを追加してもログイン出来ないか
  • authorized_keysファイルのtypo
  • ssh -vvvv {user}@{hostname} とかしてログ眺める

今回の解決の経緯

Debian,UbuntuでのApacheの実行ユーザーであるwww-dataでログインしようとしていた。
「調べた事」に書いてあった事は全部調べて、vvvvしたログをググった

ssh sign_and_send_pubkey we sent a publickey packet, wait for reply - Google 検索

そしてここを見つけた

debian - SSH keys fail for one user - Server Fault

/var/log/auth とか書いてあるじゃないか。

Authentication refused: bad ownership or modes for directory /var/www

oops

15
14
1

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
15
14