Thursday, February 21, 2019

linux - Can't reset permissions on amazon ec2

I've a big problem:



when I try to sudo something, this is what append:



sudo: /etc/sudo.conf is owned by uid 222, should be 0
sudo: /etc/sudoers is owned by uid 222, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin



I tried to detach volume and retach it into a new istance, then I mount it and I set right permission also with chown and chmod: doesn't work.



I also tried this:



chown root:root /etc/sudoers
chmod 440 /etc/sudoers
chown -R root:root /etc/sudoers.d
chmod 755 /etc/sudoers.d

chmod 440 /etc/sudoers.d/*


same result: doesn't work.
Worse I can't connect to ssh.



How can I fix this ?



here debug with -vv:




debug1: /etc/ssh/ssh_config line 50: Applying options for *
debug2: ssh_connect: needpriv 0
ssh: Could not resolve hostname ec2-user: Name or service not known


Really thanks for support.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...