Search code examples
linuxpermissionsterminalfilesystemsnautilus

Why in nautilus you can access directories without execution privileges, and in terminal you can't?


When I remove execution privileges (and just leave it with r) from a directory using

chmod 400 sampledir

and try to acces with

cd sampledir

it says permission denied, but if I use nautilus to open it, i can open it and see its contents, Why is that? I read in some place that i terminal you have to execute the directory and the directory will lists its contents, but I think when you use cd, cd is the program and the directory name would be the parametter. That is just an hipothesis becouse i've been reading on google and i cannot understand yet. Thanks a lot for any help.


Solution

  • chdir(2) requires search (execute) permissions on every component in the path. open(2) and readdir(3) do not. By not attempting to change the process' working directory, nautilus bypasses the execute permission requirement.