I used sudo gedit before I learned that I am supposed to use gksudo gedit. The side effect of this error is that some files change ownership. There seem to be 3 candidates in this screenshot that may exhibit the problem. Is there something wrong with the ownership listed here or do I need to wipe out Ubuntu, reformat, and reinstall? Is it possible to repair the ownership situation and if so, which files now have incorrect ownership? How deep does the ownership problem go? All directory levels? Is the screenshot of the ~ directory sufficient to diagnose what happened or do more directory levels need to be examined and corrected? A reformat would be inconvenient so I'm hoping there is a programmatic fix.

- 10,039
2 Answers
Is there something wrong with the ownership listed here or do I need to wipe out Ubuntu, reformat, and reinstall?
Yes. But you don't need to re-install.
Is it possible to repair the ownership situation and if so, which files now have incorrect ownership? How deep does the ownership problem go? All directory levels?
Yes. A command to find them is given in What is the difference between "gksudo nautilus" and "sudo nautilus"?:
find $HOME -not -user $USER -exec ls -lad {} \;
Is the screenshot of the
~directory sufficient to diagnose what happened or do more directory levels need to be examined and corrected?
Since everything in $HOME should be owned by you, this is sufficient.
One command to fix the ownership would be:
sudo chown $USER:$(id -g) -R ~
id -g prints your primary group name.
Or, you could adapt the file-listing command mentioned above to do only necessary chowning:
sudo find $HOME -not -user $USER -exec chown $USER:$(id -g) {} +
To fix this, you would run:
sudo chown -R brian:brian ~
For other people, replace both instances of brian with your username.
- 4,310
- 2
- 19
- 24