Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

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?

share|improve this question

migrated from serverfault.com Oct 20 '12 at 19:15

This question came from our site for system and network administrators.

up vote 3 down vote accepted

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
share|improve this answer
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
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
@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 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.