Have an EC2 instance. Connect via ssh. Can navigate through directories.

When I try to use a sudo command, I am prompted for a password.

ubuntu@ec2-ip-address:/etc$ sudo su root
[sudo] password for ubuntu:

I haven't ever set a password. That is what SSH is for. How do I change to the root user?


You need to do any of:

  • set a password for your user
  • set a password for root and use su
  • change the sudoers file to allow passwordless sudo
  • 1) change sudoers file - can't access, permission denied; can't chmod because a password is required. 2) how can I set a password for user or root? – csi Oct 19 '12 at 19:34
  • 1
    Presumably you're using an AMI provided by Amazon? It should have a default password for that user. – MikeyB Oct 19 '12 at 19:38
  • Sorry still struggling... According to a few articles, the Amazon Ubuntu AMIs don't have passwords for user ubuntu -> superuser.com/questions/456885/… – csi Oct 19 '12 at 19:45
  • 1
    @ChristopherIckes This would be a question for the folks who provided the AMI. You must have either a root password (usable with su) or a user password (usable with sudo) in order to switch to root... – voretaq7 Oct 19 '12 at 21:18
  • The AMI was errantly switched from an Amazon AMI to a 3rd party. Switched back to Amazon AMI and issue is solved. – csi Oct 22 '12 at 0:40

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.