Checking, reviewing, and modifying file permissions
153
Remember that,
in Linux, everything is a file.
Now, let’s review the five different blocks of information that the permissions include by using the ones for /usr/bin/bash:
-rwxr-xr-x.
The blocks areas follows:
Table 5.1 – File permissions by block
Let’s review them again,
as they are very important Block 1 is for the special permissions that the file may have. If it is a regular file and has no special permissions (as in this case, it will appear as -:
Directories will appear with d Links,
usually symbolic links, will appear with an l Special permissions to run a file as a different user or group, called
setuid orb setgidb, will appear ass Special permissions for directories so that the owner can
only remove or rename the file, called ab sticky bit, will appear as tb Block 2 is the permissions for the user owning the file, and consists of
three characters The first one, r, is the read permission assigned The second one, w, is the write permission assigned The third one, xis the executable permission (note that the executable permission for directories means
being able to enter them Block 3 is permissions for the group. It consists of the same three characters for read, write, and execute (rwx). In this case,
write is missing Block 4 is the permissions for others. It also consists of the same three characters for read, write, and execute (rwx) as before. As in the previous block, write is missing
Block 5 indicates that there is an
SELinux context applied to the file. More on this topic in Chapter 10, Keeping Your System Hardened with SELinux.
Securing Systems with Users, Groups, and Permissions
154
To change permissions fora file, we will use the chmod command.
First, let’s create a file:
Share with your friends: