Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like the following result on my UNIX system:

ls -l /users/test -> permission denied, or any other way so I can't see the content of it.

ls -l /users/test/testdir/ -> shows all files in the directory

Do you have any solutions for this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

By leaving only execute permissions on the parent folder and normal permissions on the child directory, you can enter the parent directory but be unable to view its contents unless you know the exact filename.

eg

mkdir -p a/b
touch a/{1,2,3} a/b/{p,o,i}
chmod 111 a
ls -la a      #Permission denied
ls -la a/b    #Lists i and o and p
share|improve this answer
add comment

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.