Assuming you have the root permissions on the system, you can use this
sudo -u USER -g GROUP find ROOTDIR -exec test \! -r {} \; -ls
where USER and GROUP should be replaced with the username and groupname whose access is to be assessed and ROOTDIR is the top directory of the directory tree under which to perform the assessment.
Caveats
Note that sudo
must be appropriately configured, meaning that root should be allowed to act as any user as well as any group.
How it works
The command works by executing the test
utility for all files and directories under ROOTDIR. The options passed to the utility make it return success (zero) exit code whenever it can not access a given file or directory. This exit code is then use by find
to determine whether to print the name of the file or directory (-ls
).
Output
Output is the list of files and directories to which USER:GROUP does not have access with extra information about each file and directory similar to the output of ls -l
(i.e. with permissions, ownership, modification time etc).
Useful things you can tweak
You can test for different kinds of permissions by replacing -r
with a different option, see man test. You can replace -ls
with -print
if you don't want the extra information about each file and directory, but just their name. Note that if the command finds directories which it cannot traverse it will also complain on stderr. Depending on what you pass to test
this may be superficial and can be dropped by redirection.