Giving Root Execute Permission on a New Tool




Download 7,3 Mb.
Pdf ko'rish
bet64/115
Sana27.11.2023
Hajmi7,3 Mb.
#106243
1   ...   60   61   62   63   64   65   66   67   ...   115
Bog'liq
linuxbasicsforhackers

Giving Root Execute Permission on a New Tool
As a hacker, you’ll often need to download new hacking tools, but Linux 
automatically assigns all files and directories default permissions of 
666
and 
777
, respectively. This means that, by default, you won’t be able to execute a 
file immediately after downloading it. If you try, you’ll usually get a message 
that says something like “Permission denied.” For these cases, you’ll need to 
give yourself root and execute permissions using 
chmod
in order to execute 
the file.
For example, say we download a new hacker tool called 
newhackertool
and place it into the root user’s directory (/).
kali >ls -l
total 80
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Desktop
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Documents
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Downloads
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Music
-rw-r--r-- 1 root root 1072 Dec 5 11.17 newhackertool
u
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Pictures


56
Chapter 5
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Public
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Templates
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Videos
We can see newhackertool at u, along with the rest of the contents of the 
root directory. We can see that our newhackertool doesn’t have execute per-
mission for anyone. This makes it impossible to use. It might seem strange 
that by default, Linux won’t let you execute a file you downloaded, but over-
all this setting makes your system more secure.
We can give ourselves permission to execute newhackertool by entering 
the following:
kali >chmod 766 newhackertool
Now, when we perform a long listing on the directory, we can see that 
our newhackertool has execute permission for the owner:
kali >chmod 766 newhackertool
kali >ls -l
total 80
--snip--
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Music
-rwxrw-rw- 1 root root 1072 Dec 5 11.17 newhackertool
drwxr-xr-x 7 root root 4096 Dec 5 11.17 Pictures
--snip--
As you now understand, this grants us (as the owner) all permissions, 
including execute, and grants the group and everyone else only read and 
write permissions (4 + 2 = 6).

Download 7,3 Mb.
1   ...   60   61   62   63   64   65   66   67   ...   115




Download 7,3 Mb.
Pdf ko'rish

Bosh sahifa
Aloqalar

    Bosh sahifa



Giving Root Execute Permission on a New Tool

Download 7,3 Mb.
Pdf ko'rish