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?

abcde123483
  • 191
  • 1
  • 1
  • 7

1 Answers1

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
Steve Mayne
  • 1,001
  • 6
  • 5