52
Chapter 5
x
The
owner of the file
y
The size of the file in bytes
z
When the file was created or last modified
{
The name of the file
For now, let’s focus on the seemingly incomprehensible strings of letters
and dashes on the left edge of each line. They tell us whether an item is a
file or
directory and what permissions, if any, are on it.
The first character tells you the file type, where
d
stands for a directory
and a dash (
–
) indicates a file. These are the two most common file types.
The next section defines the permissions on the file. There are three sets
of three characters, made of some combination of read (
r
), write (
w
), and
execute (
x
), in that order. The first set represents
the permissions of the
owner; the second, those of the group; and the last, those of all other users.
Regardless of which set of three letters you’re looking at, for files, if
you see an
r
first, that user or group of users
has permission to open and
read that file or directory. A
w
as the middle letter means they can write to
(modify) the file, and an
x
at the end means they can execute (or run) the
file or access the directory. If any
r
,
w
, or
x
is replaced with a dash (
-
), then
the respective permission hasn’t been given. Note that users can have per-
mission to execute only either binaries or scripts.
Let’s use the third line of output in Listing 5-1 as an example:
-rw-r--r-- 1 root root 33685504 June 28 2018 hashcat.hcstat
The
file is called, as we know from the right end of the line,
hashcat.hcstat.
After the initial
–
(which indicates it’s a file), the permissions
rw-
tell us that
the owner has read and write permissions but not execute permission.
The next set of permissions (
r--
) represents those of the group and
shows that the group has read permission but
not write or execute permis-
sions. And, finally, we see that the rest of the users also have only read per-
mission (
r--
).
These permissions aren’t set in stone. As a root user or file owner, you
can change them. Next, we’ll do just that.