Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
50
rated 0 times [  50] [ 0]  / answers: 1 / hits: 542770  / 2 Years ago, mon, august 29, 2022, 11:28:01

I have run following command accidentally



sudo chown [username] -hR /


Now sudo su getting error:



sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set


How to Solve This?


More From » sudo

 Answers
3

Back up your data and reinstall.



This probably looks extreme but this isn't just sudo. You destroyed the permission structure of your entire filesystem. Some of the other answers can get sudo working, but ignoring the whole problem is inviting a later disaster.



You could try to mirror the owners off another install but there are cases (/var/ for example) that are highly dependant on what you've actually got installed. If you want to get a scale of the problem, I've actually had a crack at helping somebody fix this sort of issue before. The fix is manual, long and could easily leave your system insecure or broken.



Picking through that mess is going to take considerably longer than a clean install.






This has had a couple of drive-bys from folks that don't understand the seriousness of the situation here. To them it looks like a big pile of unnecessary work, the sort of thing a rogue plumber or mechanic says to shake you down for a bigger job.



If you've only changed the permissions on /usr/bin/sudo, by all means, just fix that. But this question is about a total system change. Every file (save the runtime-only ones) are now owned by the user. Everything the user runs (eg browsers, browser exploits) could then overwrite system files, spy on you, extract any data. This needs to be corrected. Per above, this is difficult. The easiest way is a reinstall.



So please, don't be lazy about this. Filesystem permissions help keep you safe, fix them.


[#25793] Tuesday, August 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
uxuriousrnal

Total Points: 279
Total Questions: 106
Total Answers: 96

Location: Fiji
Member since Wed, Mar 29, 2023
1 Year ago
uxuriousrnal questions
Wed, Mar 9, 22, 09:04, 2 Years ago
Mon, Jul 18, 22, 01:48, 2 Years ago
Wed, Apr 13, 22, 01:15, 2 Years ago
Thu, Aug 26, 21, 22:01, 3 Years ago
;