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


[user@rhel-instance ]$ sudo adduser ellen



Download 1.85 Mb.
View original pdf
Page63/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
[user@rhel-instance
]$ sudo adduser ellen

[user@rhel-instance
]$ id ellen

uid=1003(ellen) gid=1003(ellen) groups=1003(ellen)
We can now create a file with your favorite editor to make the new user account, ellen, able to run admin commands. Let’s create the /etc/sudoers.d/ellen file with this content:
ellen ALL=(ALL) ALL
With this, we are using the /etc/sudoers.d directory to extend the sudo configuration.
We will review the detailed configuration of sudoers here despite it not being part of the RHCSA exam. As you can see, there are three fields separated by spaces or tabs to define policies in the configuration files. Let’s review them The first field is to specify who is affected by the policy We can add users by simply putting the username in the first field We can add groups by using the % character before the name of the group in the first field.

Securing Systems with Users, Groups, and Permissions The second field is for where the policy applies We have so far used ALL=(ALL) to specify everything In the first part of this field, we can define a group of computers to be run, such as SERVERS In the second part, we can specify commands such as NETWORK=/usr/sbin/ip.
‚ Between parentheses is the user account that can be used to run the command The third field is to specify which commands will use the password and which won’t.
The syntax goes as follows:
user hosts = (run-as) commands
Let’s see an example:
Runas_AliasDB = oracle
Host_Alias SERVERS=10.0.0.0/255.255.255.0
Cmnd_Alias NETWORK=/usr/sbin/ip pete SERVERS=NETWORK
julia SERVERS=(DB)ALL
We have already seen how to provide administrative access to users in RHEL and even how to do it in a very granular manner. Let’s move on now to the section on working with file permissions.
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 seethe 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):

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