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 (
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).