1

If I grant execute permission to all users (who are not owner, and not same group user, --x in this case), here is an example below, I want to confirm my understanding is correct -- it means anyone could cd to the dictionary, but cannot using command like "ls" to list content of the dictionary? I am using CentOS Linux.

drwxrwx--x 4 root root    4096 Feb 27 15:02 .

thanks in advance, Lin

1

The letters rwxXst select file mode bits for the affected users: read (r), write (w), execute (or search for directories) (x)

man chmod

Your understanding is nearly correct, but the x-flag is generally not about listing files but about executing them. If you set +x for directories, you can search them (find, ls etc.), but not read the actual contents of the files.

  • 1
    @LinMa No, you have to set '--x' for all files inside the folder, but not on the folder, because then users can search the folder (find, ls, etc.) – Thor77 Feb 29 '16 at 11:50
  • 1
    @LinMa you just have to set +x on the binary files. +x has a different behaviour on folders and files (as already mentioned in my answer). – Thor77 Mar 1 '16 at 9:48
  • 1
    @LinMa For your unix-system it's no difference if you enter the directory and run ./binfile or directly ./path/to/dir/binfile – Thor77 Mar 1 '16 at 20:23
  • 1
    @LinMa The user can cd into the directory (not sure though, just try it) but can't run ls – Thor77 Mar 1 '16 at 21:43
  • 1
    @LinMa My assumption was wrong, you need +x access to the directory with your bin-files to access (read, write, execute) them: Screencast – Thor77 Mar 2 '16 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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