AWS SSH connection error: Permission denied (publickey)

后端 未结 9 1674
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 22:58

Im trying to connect to my EC2 instance with SSH and Iḿ getting crazy. I have read this post and tried all user combinations:

AWS ssh access 'Permission denied (

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 23:34

    While not specific to AWS, this unhelpful error message

    debug1: key_parse_private2: missing begin marker

    will occur under a handful of obscure scenarios, such as when the ownership (or the permissions) on the SSH user's home directory are incorrect on the remote machine.

    The best way to troubleshoot this and similar obscure messages is to examine the authorization log on the remote machine, provided you have access, as it will usually pinpoint the problem. On Debian and Ubuntu systems, this is most easily accomplished with tail (use sudo as appropriate):

    tail -f -n 80 /var/log/auth.log

    In my particular case, I found

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

    Perfectly accurate and concise: the owner:group was set to daemon:daemon when it should have been www-data:www-data (this was on a Ubuntu machine that must have had some other web-server installed in the past).

提交回复
热议问题