16.12 Ownership and Permissions 247
Beyond the first item, in the following three sets, we’ll see one of the following:
r –file can be read
w –file can be written to
x –file can be executed (if it’saprogram)
When we see a dash in owner, group or others, it means that particular permission hasn’t been
granted.
Let’s look again at first column of sneakers.txt and identify its permissions. (See Figure 16.17)
[billy@localhost billy]$ ls -l sneakers.txt
-rw-rw-r-- 1 billy billy 150 Mar 19 08:08 sneakers.txt
[billy@localhost billy]$
Figure 16.17: A closer view of permissions
The file’sowner,billy, has permission to read and write to the file; it’s not a program, so billy
doesn’t have permission to execute it. The group, billy, has permission to read and write to sneak-
ers.txt, as well. Similar to the program notation for owner billy,there’s no execute permission
for group billy.
In the last set, we can see that those who aren’t either the user billy or in the group called billy
can read the file, but can’t write to it or execute it.
We can use the chmod command to change a file’s permissions.
Let’s work a bit more on sneakers.txt to change the permissions with the chmod command.
The original file looks like this, with its initial permissions settings:
-rw-rw-r-- 1 billy billy 150 Mar 19 08:08 sneakers.txt
As long as we’re the owner of the file – or we’re logged into the root account – we can change
permissions in any combination of settings for the owner, group and others.
Right now, the owner (that’sus)andourgroup(whichisbilly) can read and write to the file.
Anyone outside of our group – for example, anyone in the adm group - can only read the file (r- -).
Comments to this Manuals