Monday , December 23 2024

Authorization Definition

In this article, I will talk about how to do operations such as granting and receiving Authorization Definition with the help of the chmod command on the directory.

Let’s explain some parameters used with chmod.

u : Used for operations related to file -directory owner.

g : File – Used for operations to be performed for users in the same group as the owner of the directory.

o : Used for actions to be taken for other users.

a : Public transactions are also used.

= : It is used in authorization synchronization operations.

+ : It is used in adding authorization operations.

– : Used in authorization operations.

Let’s reinforce it with examples.

First, we go into our directory and look at the permissions of the files in it with the ls -l command.

Let’s read the authority of our files above and get their authority as follows,

but before that, let’s make a small reminder as you can remember from my previous articles,

W (write)

R (read)

X (execute)

it meant.

After making a small reminder, let’s get the privileges of the gray text documents above with the help of the following command.

The “*” at the end of the command below means do it for all under that directory.

As we can see when we do ls -l again after receiving the permissions, we see that they do not have permissions, but we see that our directory has execute(x) permission.

To change it, we can change it by typing the following command.

Above, we can see that we can only get the execute permission of the relevant file by giving the file name instead of *.

We have authorized the files and directories, now let’s talk about how they are given.

As seen above, we have given read permission to all files and directories. You can also do this for execute and write permissions.

We will use the above-mentioned u parameter to define the read, write and execute privileges for the frk user who owns the file.

As seen above, read, write and execute permissions are given for all directories and files.

You can use the following command to grant writes for users in the frk group.

We have given and received authorization using the wrx parameters so far, but it is also possible to give them with the help of numbers.

*                        File_Owner          Group Authority                Other Users
Reading ( r )                  4                                  4                                           4
Writing ( w )                  2                                  2                                           2
Execute ( x )                  1                                   1                                            1

Let’s get the permissions we have given using the above commands.

For this we need to type chmod -700 but what does it mean? We can do the expansion like this:

r (4)+ w (2)+ x (1)=700

As above, it is defined as 700 by adding 4 for read, 2 for write, and 1 for execute.

*                       File_Owner             Group Authority               Other Users
Reading ( r )                4                                      4                                         4
Writing ( w )               2                                       2                                         2
Execute ( x )               1                                       1                                          1

TOTAL                         7                                       0                                         0

To get the privileges of the file owner, we will use the 700 parameter as follows.

As seen above, authorizations have been obtained.

If we wanted to get the authorization of all of them, that is, if we wanted to get the authorization of File_Owner, Group Authorization and Other Users, as a result of adding all of them as follows, a number like 777 comes out.

With this number, we can get all authorizations as follows.

As seen above, all authorizations have been taken.

Let’s grant read permission for file_owner , users in the group, and other users.

As can be seen above, we have defined read authorization for all of them by typing 444.

Loading

About Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *