日々精進

新しく学んだことを書き留めていきます

sshでアクセスすると公開鍵認証してほしいのにパスワードを聞かれる

ssh hostname -vvvTを実行すると以下のログが出る。

debug1: Trying private key: /c/Users/username/.ssh/mykey.pem
debug3: sign_and_send_pubkey: RSA SHA256:nQr29X+3juJvSWOedeEVmgKCZgaO169LKCvAZCKkFKM
debug3: sign_and_send_pubkey: signing using rsa-sha2-512 SHA256:nQr29X+3juJvSWOedeEVmgKCZgaO169LKCvAZCKkFKM
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password

「receive packet: type 51」はユーザの認証に失敗したという意味。 今回の原因は/home/username/.sshフォルダの権限が600になっていたため。正しくは700。 sshはほんとハマリやすい。。