3 Basic Commands and Simple Shell Scripts Once you have your first Red Hat Enterprise Linux rhel


[root@rhel-instance ]# ls -l /usr/bin/bash



Download 1.85 Mb.
View original pdf
Page64/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   59   60   61   62   63   64   65   66   67
Pablo Iranzo Gómez, Pedro Ibáñez Requena, Miguel Pérez Colino, Scott McCarty - Red Hat Enterprise Linux 9 Administration-Packt Publishing (2022) -chap 3 82 - 180
[root@rhel-instance
]# ls -l /usr/bin/bash

-rwxr-xr-x. 1 root root 1390064 Aug 9 2021 /usr/bin/bash
[root@rhel-instance
]# ls -l /etc/passwd

-rw-r--r--. 1 root root 1740 Mar 11 21:35 /etc/passwd
[root@rhel-instance
]# ls -l /etc/shadow

----------. 1 root root 1170 Mar 11 21:35 /etc/shadow
[root@rhel-instance
]# ls -ld /tmp

drwxrwxrwt. 5 root root 4096 Mar 11 17:35 /tmp

Checking, reviewing, and modifying file permissions
153
Remember that, in Linux, everything is a file.
Now, let’s review the five different blocks of information that the permissions include by using the ones for /usr/bin/bash:
-rwxr-xr-x.
The blocks areas follows:
Table 5.1 – File permissions by block
Let’s review them again, as they are very important Block 1 is for the special permissions that the file may have. If it is a regular file and has no special permissions (as in this case, it will appear as -:
‚ Directories will appear with d Links, usually symbolic links, will appear with an l Special permissions to run a file as a different user or group, called setuid orb setgidb, will appear ass Special permissions for directories so that the owner can only remove or rename the file, called ab sticky bit
, will appear as tb Block 2
is the permissions for the user owning the file, and consists of three characters The first one, r, is the read permission assigned The second one, w, is the write permission assigned The third one, xis the executable permission (note that the executable permission for directories means being able to enter them Block 3 is permissions for the group. It consists of the same three characters for read, write, and execute (rwx). In this case, write is missing Block 4 is the permissions for others. It also consists of the same three characters for read, write, and execute (rwx) as before. As in the previous block, write is missing Block 5 indicates that there is an SELinux context applied to the file. More on this topic in Chapter 10, Keeping Your System Hardened with SELinux.

Securing Systems with Users, Groups, and Permissions
154
To change permissions fora file, we will use the chmod command.
First, let’s create a file:

Download 1.85 Mb.

Share with your friends:
1   ...   59   60   61   62   63   64   65   66   67




The database is protected by copyright ©ininet.org 2024
send message

    Main page