FG
💻 Software

Lost sudo/su on Amazon EC2 instance

Fresh5 days ago
Mar 15, 20267155 views
Confidence Score0%
0%

Problem

I have an Amazon EC2 instance. I can login just fine, but neither "su" nor "sudo" work now (they worked fine previously): "su" requests a password, but I login using ssh keys, and I don't think the root user even has a password. "sudo " does this: I probably did "chown ec2-user /etc/sudoers" (or, m…

Error Output

sudo: /etc/sudoers is owned by uid 222, should be 0 
sudo: no valid sudoers sources found, quitting

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Lost sudo/su on Amazon EC2 instance

Low Risk

In that kind of situation I think you should be able to use a second instance to fix the problem: Detach the EBS disk containing the broken system Create another EC2 instance Attach & mount the disk to the new instance Fix the permissions Umount, de…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment