discover the directory that prevents a file from being read in linux

7

1

i'm getting a permission denied for a user in a really long path.

$ sudo sudo -u user cat /l/o/n/g/path/file
Permission denied

i'm pretty sure path and file have permissions for that user. Is there any easy way to find which of the other directories in /l/o/n/g does not?

gcb

Posted 2013-04-24T17:59:28.623

Reputation: 3 392

Answers

3

This will redirect the standard output of find to /dev/null, and display only the errors (including permission denied) while accessing directories.

find . -type d > /dev/null

MikeF

Posted 2013-04-24T17:59:28.623

Reputation: 61

nice! find l/ -type d > /dev/null find: l/o/n: Permission denied – gcb – 2013-10-22T00:18:17.307

3

If you're okay with limiting the check to user/group/other permissions, use

namei -l /l/o/n/g/path/file

user1686

Posted 2013-04-24T17:59:28.623

Reputation: 283 655