I am using Ubuntu.
I ran the following command. But I stopped it after a while because I felt it was taking too long.
sudo chown -R $USER:$USER /
This made the sudo command to stop working. So I found a solution to bring back sudo to root by using this command in the emergency console (we can't use SSH with root):
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
Then I read comments online that it is advisable to reinstall the OS because many permissions would have been changed.
However I ran find / -user [username]
on the server and another instance of the server with a saved image from before I ran the first chown command, I only found a handful of files that had different permissions. Why could that be? Why did only the /usr/bin/sudo
file get changed and nothing else?
The only files where the user permissions are different are /proc
and /sys/fs/cgroup/systemd/user/
. They contain new files with user permissions given to the user that I chowned to. Does this look right or do I need reinstall the OS because these files are different to the saved image?
Thanks!