0

Root does not own the /home/* folders, but what other folders does root not own?

Tim
  • 33,500

2 Answers2

3

If your purpose is to find all files and directories accessible by you, use find utility with -group flag.

 sudo find / -group $USER  | less 

If you want to filter out only directories, use -type flag

 sudo find / -type d -group $USER  | less 

More info in man find. Ownership of files found might belong to root, but if a file belongs to your group, as well as has read permissions for your group, you can access those files

To find files owned by you , use -user flag

find / -user $USER -ls | less

On a side note, you may want to search without sudo, because if a file is owned by you but not readable by others, it may throw error for sudo

To avoid errors in the output, use 2>/dev/null redirection. Like so

find / -user $USER -ls 2> /dev/null | less
2

Apart from user folders that aren't root, everything it root owned. That's why you should only use su or sudo if you need to, because you can really mess things up.