0

linux, how to reset properties on the command files 'su' and 'sudo?' What is the exact command syntax, please?
I unthinkingly changed the entire /bin and /usr/bin directories and contents to "user" and "group," instead of root and root. Plus they lost the setguid and setuid properties. I was trying to fix a different problem and just wasn't thinking when I did "chown -H 'user' *" and then the same thing with "chgrp."

It is on an SD card for a Raspberry Pi 2, so I have tried putting the SD card in a desktop Linux box to fix the attributes but am confused by what I see on the web about which exact syntax to use.

Thanks.

skypuppy
  • 1
  • 2
  • It might be better to just reinstall. – yellowantphil Feb 22 '16 at 00:13
  • Waaay too many hours and days getting this software to where I want it to throw in the towel. Qt is E-X-T-R-E-M-E-L-Y difficult to install, whether to run natively on the RPi2 or to cross-compile from a Linux host desktop. I ain't giving that up without a fight! :) :) – skypuppy Feb 22 '16 at 02:40
  • Can you install it again on something else, so you can see what the file permissions are supposed to be? – yellowantphil Feb 22 '16 at 02:52
  • I have other Linux boxes where su and sudo are still fine. I don't know how to turn their permission bits into a number that I could then chmod or chattr for the screwed-up one. – skypuppy Feb 22 '16 at 14:25
  • I've never used `chattr`. If you know which user you want, `chown`ing the files back shouldn't be a problem. `chmod` lets you change permissions with letters, like `+r`, although I've never used that syntax. Or you could figure out/look up the numbers... 755 (execute, writeable only by owner), 644 (read), and 4755 (execute, suid) should get you pretty far. It would be best to get the owners and permissions from the same distribution, instead of just any Linux. – yellowantphil Feb 22 '16 at 14:33
  • Su and sudo are a bit more complex, though. They need something with setgid and setuid but I don't know what or even if those bits are only used on other programs when called by sudo. – skypuppy Feb 22 '16 at 23:08
  • Looks like my `sudo` has permissions 4111 (never seen that before...) and my `su` has permissions 4755. Not sure if that is relevant to what you're trying to do. – yellowantphil Feb 22 '16 at 23:23
  • What command did you run to get those numbers? I only get the string one sees in "ls -al." – skypuppy Feb 23 '16 at 01:09
  • I did it the dumb way, by guessing and checking. "`touch tmp; chmod 4111 tmp; ls -l tmp`... oh look, that one matches." So apparently the lowercase s in `---s--x--x` means "suid and execute". It's probably explained in some `ls` documentation that I've never read. – yellowantphil Feb 23 '16 at 01:51

0 Answers0