I get this error trying to run sudo command sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

0

I get this error trying to run sudo command "sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set" In all our instances, yesterday evening there was no issues, but this morning I noticed that the apps are not working anymore. when I connected to my instances, i got the error when i try to run any command with sudo.

Please if someone had the same issue or have any idea why this happened, thanks in advance.

已提問 1 年前檢視次數 6085 次
2 個答案
0

You may have changed the permissions on "/usr/bin/sudo".
To correct the problem, access the site as the root user and execute the following command.
However, a password must be set for the root user in advance.
If it is not set up, this method cannot be used.

su
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo

For other methods, please refer to the following documents.
https://repost.aws/knowledge-center/ec2-sudo-commands

profile picture
專家
已回答 1 年前
0

I couldn't be a root user by using the "su" command because I didn't have a root password, but instead I used this command to become a root user: systemd-run --shell and after that: chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo My problem is solved.

profile picture
已回答 5 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南