0

I ran:

chown -R [myuser] /*

by mistake and now Ubuntu won't boot. All I see is the loading screen for Ubuntu. I cannot ssh into the machine. The Apache server is down, but ping works. In root shell (when I booted into recovery) I discovered sudo didn't work as well due to incorrect permissions for the /etc/sudoers file. I managed to fix that. The machine still doesn't boot though.

How do I revert the changes made by chown -R [mynonrootuser] /*? How do I get everything back to its default permissions?

1 Answers1

0

Resetting the owner names and owning group names can take many hours. Basically you need another partition (or Live USB with persistence and all the Apps installed) and then clone the permissions from the working installation to the broken one:

Although I didn't intentionally do this on my own system, I was developing a script and before fully debugged it peformed chown on /etc and some other system directories. I used the information in the above accepted answer and wrote my own script to fix the owner name and owning group name for every file.

Most people would simply reinstall the system and all the apps previously installed. However for myself I couldn't remember all the configuring I've done in /etc and elsewhere over five years so writing a script seemed the path of least resistance.