Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 80984  / 2 Years ago, fri, april 15, 2022, 10:46:34

I entered chmod -R 777 /usr/bin and now sudo is not working.



It says sudo must be setuid root.



Some advice online said to run chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
.



On entering chown root:root /usr/bin/sudo it shows an opened in readonly mode error.


More From » permissions

 Answers
7

Accepted status notwithstanding, I'm now convinced this answer is wrong. (I hope to improve it soon, after consulting with the OP about the accept.) I think I recall others saying this worked, but I believe their problems were at least slightly different. The method described herein remains valuable for some situations where chmod -R 777 /usr/bin is interrupted with Ctrl+C or otherwise does not complete. But once it does, pkexec is un-setuid'd too and it won't work any better than sudo, as Damien Roche and Oli have rightly commented.




On an Ubuntu desktop system, PolicyKit is installed, so pkexec can be used to repair a broken sudo executable or sudoers file. You do not need to boot into recovery mode and you do not need to boot from a live CD. You don't even need to reboot.



In this case, run the following commands:



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


See this question for more information.


[#39030] Sunday, April 17, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
chilgirlguid

Total Points: 123
Total Questions: 114
Total Answers: 121

Location: Macau
Member since Mon, Nov 16, 2020
4 Years ago
;