I did something stupid:
chown -R root:root /usr chmod -R g-w /usr
Apparently, the best thing I can do is reinstall the system. However, my system works fine so far - is there anything immediately dangerous not fixing this asap? I have Ubuntu 18.04 (no Internet connection), it is just used as a local NAS.
The reason I did this was due to a warning when doing updates:
WARN: uid is 0 but '/usr' is owned by 1000 WARN: /usr is group writable!
I asked and someone in a forum suggested the above commands with "it is perfectly safe". Lesson learned: Don't trust people on the Internet, even if they sound totally convinced.
The reason, apparently, why
/usr was group writable and not owned by root is because of my specific DIY-Nas Ubuntu (Odroid):
drwxrwxr-x 10 odroid odroid 4096 Apr 12 2018 usr
Perhaps I should have not used the
-R recursive option. It doesn't matter now.
The last few hours, I looked through various posts to find out what I did. It looks like running any
setgid bits, so I would need to manually compare to an existing system to restore all of those once I have fix the ownership again. For fixing
sudo command, I already did this:
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
Besides this, I don't see any more problems. When I log in to Ubuntu interface, I get a permission warning from some Bluetooth Software, but it is not immidiatly relevant.
I understand that there is some software in /usr that has a group other than
root (see list here, for example), for reasons of security - but will there be any really negative effects on my nas-system, especially related to file handling/archive things, e.g. corrupted or inaccessible files?
Note that I created a new stackexchange account because I am too embarrassed.. anyway, many thanks for suggestions!