Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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
share|improve this answer
    
nice! find l/ -type d > /dev/null find: l/o/n: Permission denied –  gcb Oct 22 '13 at 0:18

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

namei -l /l/o/n/g/path/file
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.