LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   file permissions OK, but command permissions? (https://www.linuxquestions.org/questions/linux-general-1/file-permissions-ok-but-command-permissions-369970/)

stabu 10-05-2005 08:37 AM

file permissions OK, but command permissions?
 
I know the various permissions that you can set on files and directories, but how different are commands?

Every thing is meant to be a file in linux, so for the "ls" command i should be able to check out "ls" in /bin and who is allowed execute it.

But read permissions? what does read permissions on a command mean? Who wants to read binary files?

I also want to know what happens when you "ls -al" or "file" a file? That's not reading it, is it? I mean I know "more" is reading a file, but "ls"?. All you're doing is asking for a name and description.

MensaWater 10-05-2005 09:14 AM

The read bit allows you to access it. Without read you can't do the ls (unless you're root) because you don't have permission. Also find wouldn't find it. Another oddity is that you have to have the execute bit on directories to read them. Just the way it is.

The "-a" flag of ls is just so you can see "hidden" files which are those that begin with a dot (.bashrc, .profile etc...). You are correct that ls only lists files - it doesn't actually read their contents.

The "-l" flag gives a "long" listing. Without it you would see only the file names with no permissions, dates or other information.

ls -la (or -al as order doesn't matter in most flags) would give you a long listing of all files in a directory including the "hidden" files.

Agrouf 10-05-2005 12:00 PM

reading permission on binaries is useful for some special purposes. For instance, if you want to create a compressed archive with commands in order to send them to another computer, your compressor need to be allowed to read the file in order to compress it.


All times are GMT -5. The time now is 01:50 AM.