I have an instance set up on AWS. It's an Ubuntu 12.04 server, and I can no longer log into ssh or sftp using my key.

I was logged into both ssh and sftp at the same time on a mac using terminal for ssh and cyberduck for sftp. I closed Cyberduck to go up for lunch and when I can back, I could no longer log in. I thought SFTP was the problem, but I closed the terminal also and could no longer log into the terminal.

When trying to log into ssh I get the following error:

Permission denied (publickey).

And when I try to log into SFTP, I get the following:

Login failed Login with username and password

I've made sure all of my login info is correct. Even if I didn't the info was bookmarked and working on cyberduck before it quit connecting.

The key has not changed nor has it changed places. I tried creating a new key, but got the same result. Nothing has change in the dashboard or on Amazon's side. The only thing I can think of that changed was I set the permissions of /var/www/ to 757 an then uploaded a large folder to it. Could that cause such a problem?

What are possibilities? Google hasn't offered me anything useful.

1 Answer 1


Unless /var/www was the home directory of your account on the remote host, it is unlikely the upload or permission change affected it. 757 is an odd permission setting though: read/write/execute for everyone, but not writable by group? Is that what you meant to set?

Connecting with ssh -v hostname will give you some debug messages that can help. For example the permissions on your local private key file needs to be readable only by you and ~/.ssh/ directory can't be writable by others, otherwise ssh will refuse to connect. The debug message will tell you that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.