Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

root access worked on my EC2 instance for a couple of weeks until I did

sudo aptitude update

sudo aptitude upgrade

and now sudo asks for a password (which I have never been given). I can't log in as root (says "Please login as the user "ubuntu" rather than the user "root".").

Does anyone know a way out of this mess ?

SOLVED: the solution is here in the accepted response: Amazon EC2 asking me to move AMI, how to go about doing it?

share|improve this question
Are you SSHing using your key? – Steve Mayne Mar 31 '11 at 19:21
Yes I'm using the .pem key generated from the ec2 management console – abcde123483 Mar 31 '11 at 19:30
And you're connecting with the ubuntu user? e.g. ssh -i <mykey> ubuntu@<myserver> ? – Steve Mayne Mar 31 '11 at 19:32
Yes that is how I'm connecting – abcde123483 Mar 31 '11 at 19:34
Sounds like your sudoers file might have changed - do you have permission to see it? /etc/sudoers – Steve Mayne Mar 31 '11 at 19:39
up vote 0 down vote accepted

Set your password by typing passwd when logged in as user ubuntu. Once you've done this, you should be able to sudo using the same password - assuming the ubuntu user is still present in the sudoers file.

It sounds as though your sudoers file no longer allows sudo to operate without specifying a password. Once you've got sudo access again, you can change the behaviour in the sudoers file:


Uncomment the line which says:

share|improve this answer

Your Answer


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

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