Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I always log in to my server(Amazon EC2) by: ssh -i blahblah.pem root@server.com This morning the server asked for a password which I never set.

I thought this could mean either my key(pem file) is corrupted somehow. Asked a friend to log in from another computer with his own copy of the pem file, he had the same problem.

Totally confused why this would happen all of a sudden, but I remembered I did this last night (which I thought was unrelated.):

/root had permissions 700.
chmod 770 root
then put it back by
chmod 700 root

made a mistake, but thought it would have no effect though.

Any suggestions to logging to my server? I am very confused by this, and I cannot create a new .pem file for my amazon ec2 instance. Thanks for the help!

share|improve this question
    
Ooh - you don't want to be logging in as root! That is what sudo and su are for! I hope your friend isn't also logging in as root... –  dunxd Nov 8 '10 at 21:57

2 Answers 2

Did you chmod -R to 770, then non-recursive back to 700? You could have screwed up perms on ~/.ssh.

share|improve this answer

The OpenSSH daemon checks the permissions of the .ssh directory as well as the files in it during the login process. If the permissions allow others to read or write the directory or certain files in it, the daemon will prevent that user from logging in.

You can try logging in using a different user. You really shouldn't be logging in and doing everything as root anyway.

If your EC2 server is EBS-backed, you can bring up another ec2 instance and mount the EBS volume on the new instance so that you can fix the permissions. Just make sure the EBS volume's "delete on termination" setting is set to "false" before you shutdown the original instance.

share|improve this answer
    
I should add that if you do try that last part, you will need to use the command line tools for ec2 in order to change the "delete on termination" setting. docs.amazonwebservices.com/AWSEC2/2010-08-31/DeveloperGuide/… –  lladnar Nov 9 '10 at 15:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.