Using sudo nautilus
I created some folders and I want to get rid of root permission on them. But I have many and I want to do it to a entire directory and its containing folders.
So how to allow read/write to current user to all files and folders inside a specific directory that is inside /home
?
Best Answer
To revert damage done using
sudo nautilus
you should make yourself the owner of any directories (and their contents) that are owned by root.You can use
find
to do this, as it has a test to find only files owned by a specific user.This will find all the directories in your home owned by root:
You can then repeat the
find
command and add the action you want to do - recursively changing ownership of all the found directories and their contents to the current user:Explanation:
~
the home directory-type d
find only directories-user root
find only stuff belonging to root-exec
do the following command on whatever was foundsudo chown -R
recursively change owner$USER
the current user:
also change group to the specific userMore efficiently, you could omit the
-type d
to find files of any type belonging to root, and also omit the-R
asfind
will do the recursion for you by acting on all the files