Accidentally change ownership of /etc/sudoer back to ec2-user
0
Got this error when trying to change it back to root. What is the best way to fix it, best if there's no need to reboot server. Thanks in advanced for willing to assist on it!
Note:
- root does not set with password, so unable to
su -
- unable to install pkexec now as it require sudo
$sudo chown root:root /etc/sudo.conf
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Uname
uname -a
Linux xxx.amzn2.x86_64 #1 SMP Fri Feb 4 17:12:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Topics
asked 2 months ago13 views
1 Answers
0
From aws console > instance > connect user: change to "root" > connect
chown root:root /etc/sudo.conf chown root:root /etc/sudoers chown -R root:root /etc/sudoers.d
Now you should be able to run sudo
command using ec2-user
account
answered 2 months ago
Relevant questions
What is the best way to work with databases in local environments?
Accepted Answerasked 7 months agoHow to change dynamically the center of mass
Accepted Answerasked 5 years agoWhat is the best way to generate a visual diagram of the AWS environment which includes VPC, VPN
Accepted Answerasked a year agoIs possible to change lambda timeout container?
asked 3 years agoAdd "insecure" to export options on NFS server.
Accepted Answerasked 3 years agoMy Website is Down and I Don't Know How to Get it Back Up
asked 5 months agoHow to remove or change a load balancer type with elastic beanstalk?
asked 2 years agoAccidentally change ownership of /etc/sudoer back to ec2-user
asked 2 months agoFrequently Linux instance is not running, have to reboot the instance to make it run again.
asked 4 months agoCannot connect to server even after reboot UPSTREAM_NOT_FOUND [519]
asked a month ago