TszHin Ma
TszHin Ma

Reputation: 197

aws ec2 ubuntu require my password

i want to build a project and failed because it requires root permission. When i change the user to root as "sudo -s", it prompted [sudo] password for ubuntu. As ec2 doesn't offer ubuntu password, it login with pem file. How can I login as root and create files? Thanks!

Upvotes: 6

Views: 15368

Answers (4)

Khalid Hussain
Khalid Hussain

Reputation: 1

AWS doesn't grant root access by default to EC2 instances. This is an important security best practise. Users are supposed to open a ssh connection using the secure key/pair to login as ec2-user. Users are supposed to use the sudo command as ec2-user to obtain elevated privileges.

Upvotes: 0

ilam engl
ilam engl

Reputation: 1570

I was surprised as well, when AWS ec2 ubuntu prompted me for a password.

[sudo] password for ubuntu: 

In the end I just hit return without inserting anything and it worked.

Upvotes: 2

essxiv
essxiv

Reputation: 541

I fixed this by doing using "sudo" for a Ubuntu AWS EC2 SSH Login:

$ sudo passwd ubuntu

Instead of prompting me for:

"(current) UNIX password:"

It prompts now for:

"Enter new UNIX password:"

I hope this fixes some problems with ec2 ubuntu users!

Upvotes: 19

anand
anand

Reputation: 1526

If you want to run commands from your terminal interactively as root do it as follows:

sudo -i

If just want to run a single command do it as:

sudo some-command-goes-here

You will not be prompted for password in any of these scenario.

Upvotes: 1

Related Questions