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



Download 1.85 Mb.
View original pdf
Page7/67
Date26.02.2024
Size1.85 Mb.
#63678
1   2   3   4   5   6   7   8   9   10   ...   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
File permissions
To review file permissions, we are going to login to the system as root. We will use the ls command to list files and we will review the permissions associated with them. We will learn more about how to change permissions in Chapter 5, Securing Systems with Users, Groups, and Permissions.
Once logged into the system as root, we can run the ls command:
[root@rhel-instance
]# ls

anaconda-ks.cfg
This shows the files present in the root user home directory, represented by
. In this case, it shows the kickstart file created by Anaconda that we reviewed in the previous chapter.
We can get the long version of the list by appending the -l option to ls:
[root@rhel-instance
]# ls -l

total 4
-rw-------. 1 root root 1106 Feb 18 19:45 anaconda-ks.cfg
We seethe following in the output total 4: This is the total space in kilobytes occupied in the disk by the files (note that we are using 4 KB blocks, so every file under that size will occupy a minimum of 4 KB -rw-------.: These are the permissions assigned to the file.

Basic Commands and Simple Shell Scripts
68
The structure of the permissions can be seen in the following diagram:
Figure 3.5 – The permissions structure for Linux
Let’s discuss the preceding structure The first character is for any special permissions that the file may have. If it is a regular file and has no special permission (as in this case, it will appear as -.
• Directories will appear with d. Consider that in Linux, everything is a file, and directories area file with special permissions Links, usually symbolic links, will appear with l. These act as a shortcut to a file from a different directory Special permissions to run a file as a different user or group, called setuid orb setgidb, will appear ass A special permission so that only the owner can remove or rename a file, called ab sticky bit
, will appear as t.
The next three characters, rw-, are the permissions for the owner The first one, r, is the read permission assigned The second one, w, is the write permission assigned The third one, x, not present and shown as -, is the executable permission. Note that executable permission for directories means being able to enter them.
The next three characters, ---, are for the group permissions and work the same way as the owner permission. In this case, no group access is granted.
The final three characters, ---, are the permissions for others, which means users or groups do not show as the ones assigned to the file 1: This indicates the number of links (hard links) to this file. This is intended, among other things, so that we do not delete a file used in another folder root (the first instance This indicates the owner of the file.

Using the command line, environment variables, and navigating through the filesystem
69
• root (the second instance This indicates the group assigned to the file 1393: This indicates the size in bytes Dec 7 16:45: This indicates the date and time that the file was last modified anaconda-ks.cfg: This indicates the filename.
When we list a directory (referred to in other systems as a folder, the output will show the contents of the directory itself. We can list the info for the directory itself with the -d option. Let’s now take a look at etc, the directory that stores the system-wide configuration:

Download 1.85 Mb.

Share with your friends:
1   2   3   4   5   6   7   8   9   10   ...   67




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

    Main page