L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h




Download 7,3 Mb.
Pdf ko'rish
bet61/115
Sana27.11.2023
Hajmi7,3 Mb.
#106243
1   ...   57   58   59   60   61   62   63   64   ...   115
Bog'liq
linuxbasicsforhackers

security 
v
newIDS
This command passes the 
security
group u ownership of newIDS v.
Now you need to know how to check whether these allocations have 
worked. You’ll do that by checking a file’s permissions.
Checking Permissions
When you want to find out what permissions are granted to what users for 
a file or directory, use the 
ls
command with the 
–l
(long) switch to display 
the contents of a directory in long format—this list will contain the permis-
sions. In Listing 5-1, I use the 
ls –l
command on the file /usr/share/hashcat 
(one of my favorite password-cracking tools) in order to see what we can 
learn about the files there.
kali >ls –l /usr/share/hashcat
total 32952
u
v
w
x
y
z
{
drwxr-xr-x 5 root root 4096 Dec 5 10:47 charsets
-rw-r--r-- 1 root root 33685504 June 28 2018 hashcat.hcstat
-rw-r--r-- 1 root root 33685504 June 28 2018 hashcat.hctune
drwxr-xr-x 2 root root 4096 Dec 5 10:47 masks
drwxr-xr-x 2 root root 4096 Dec 5 10:47 OpenCL
drwxr-xr-x 3 root root 4096 Dec 5 10:47 rules
Listing 5-1: Checking a file’s permissions with the long listing command
On each line, we get information about:
u
The file type (this is the first character listed)
v
The permissions on the file for owner, groups, and users, respectively 
(this is the rest of this section)
w
The number of links (This topic is beyond the scope of the book.)


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.

Download 7,3 Mb.
1   ...   57   58   59   60   61   62   63   64   ...   115




Download 7,3 Mb.
Pdf ko'rish

Bosh sahifa
Aloqalar

    Bosh sahifa



L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h

Download 7,3 Mb.
Pdf ko'rish