Читать книгу Kali Linux Penetration Testing Bible - Gus Khawaja - Страница 27

Permissions

Оглавление

For the permissions, the same principle applies to a file or a directory. To simplify it, the permissions are divided into three categories:

 Read ( r ): 4

 Write ( w ): 2

 Execute ( x ): 1

The permissions template applies the following pattern:

[User:r/w/x] [group:r/w/x] [everyone:r/w/x]

Figure 1.6 Kali Linux – Files and Folders Commands

Let's look at a practical example. Lat's say you created a simple shell script that prints “test” (using the echo command) and that you wanted display its permissions (take note that this example uses the root user inside the terminal window):

root@kali:~# echo 'echo test'> test.sh root@kali:~# ls -la | grep 'test.sh' -rw-r--r-- 1 root root 10 Sep 22 11:25 test.sh root@kali:~#

From the previous output results, we can see the following:

 For the root user, you can read and write because of rw at the beginning.

 For the root group, they can only read this file.

 For everyone else on the system, they can only read as well.

Let's say you want to execute this file, since you're the one who created it and you're the master root. Do you think you'll be able to do it (according to the previous permissions for the root user)?

root@kali:~# ./test.sh bash: ./test.sh: Permission denied

Kali Linux Penetration Testing Bible

Подняться наверх