2

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?

1 Answer 1

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .