0

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?

11
  • Are you SSHing using your key? Mar 31, 2011 at 19:21
  • Yes I'm using the .pem key generated from the ec2 management console Mar 31, 2011 at 19:30
  • And you're connecting with the ubuntu user? e.g. ssh -i <mykey> ubuntu@<myserver> ? Mar 31, 2011 at 19:32
  • Yes that is how I'm connecting Mar 31, 2011 at 19:34
  • Sounds like your sudoers file might have changed - do you have permission to see it? /etc/sudoers Mar 31, 2011 at 19:39

1 Answer 1

0

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:

/etc/sudoers

Uncomment the line which says:

%sudo ALL=NOPASSWD: ALL

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .