I have an AWS linux instance running that I'm trying to SSH into. When I type in the manual command (using mac, terminal):

ssh -i ~/.ssh/PEM.pem root@IPADDRESS

it works fine, but when I try to give that an alias in the config file in my SSH colder, such as

Host hostname
User root
IdentityFile "file"
HostName IPADDRESS

I get the error:

Permission denied (publickey).

I have other AWS aliases in my config file with the exact same setup that work fine, any ideas? Thanks.

Update I figured out what was going on here, I had a trailing whitespace at the end of my .pem location. Man is that stuff finicky.

link|improve this question
have you looked at hosts.allow and hosts.deny? I'd also check out /var/log/secure and /var/log/messages on the AWS linux instance and see what they have to say. – George Mar 24 '11 at 11:09
Try ssh -v, it will dump a lot of information, maybe some will be useful. (-vv for even more info. :) – sarnold Mar 24 '11 at 11:10
@Caleb, good catch. Add it as an answer and accept it, so others might be spared going nuts. :) – sarnold Mar 24 '11 at 11:19
Also, make sure there is a 600 permission on whole .ssh and content of it – Ency Mar 24 '11 at 11:40
feedback

migrated from stackoverflow.com Mar 24 '11 at 11:38

This question came from our site for professional and enthusiast programmers.

1 Answer

I figured out what was going on here, I had a trailing whitespace at the end of my .pem location. Man is that stuff finicky.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown