Checking, reviewing, and modifying file permissions
So far, we have learned how to create users and groups and even provide administrative capabilities to them. It’s now time to see how permissions work at the file and directory level.
As you’ll remember, in Chapter 3, Basic Commands and Simple Shell Scripts, we already saw how to see the permissions that are applied to a file. Let’s review them now and dive deeper.
Let’s get the permissions info for some example files by listing it with –l
, for the long option. Remember to run this as the root
user (or using sudo
):
[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...