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



Download 1.85 Mb.
View original pdf
Page58/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   54   55   56   57   58   59   60   61   ...   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
Account expires : Jan 01, 2030
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires 7
Important Note
In RHEL 9 some of the password controls are also configured using the /etc/security/
pwquality.conf file, for example, the minimal acceptable size for the new password
(minlen parameter) or the maximum credit for having uppercase or lowercase characters. You may want to check this file in case you need to change these parameters.

Securing Systems with Users, Groups, and Permissions
146
To change the default values, we will edit /etc/login.defs. Let’s check the section for the most common changes:
# Password aging controls:
#
# PASS_MAX_DAYS Maximum number of days a password maybe
used.
# PASS_MIN_DAYS Minimum number of days allowed between
password changes.
# PASS_MIN_LEN Minimum acceptable password length.
# PASS_WARN_AGE Number of days warning given before ab bpassword expires.
#
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_WARN_AGE 7
Please take some minutes to review the options in /etc/login.defs.
Now, we could have a situation in which a user has left the company. How can we lock the account so the user cannot access the system The usermod command has the L option, for lock, to do so. Lets try it. First, let’s log into the system:
Figure 5.1 – The usertest user account logging into the system
Now, let’s lock the account:
[root@rhel-instance
]# usermod -L usertest

[root@rhel-instance
]# grep usertest /etc/shadow

usertest:!$6$4PEVPj7M4GD8CH.4$VqiYY.
IXetwZA/g54bFP1ZJwQ/yc6bnaFauHGA 11eFzsGh/
uFbJwxZCQTFHIASuamBz.27gb4ZpywwOA840eI.:18651:0:99999:7:3
:21915:

Adjusting password policies
147
Notice that there is a ! character added before the password hash. This is the mechanism used to lock it. Let’s try to login again:
Figure 5.2 – The usertest user account not being able to log into the system
The account can be unlocked by using the U option:

Download 1.85 Mb.

Share with your friends:
1   ...   54   55   56   57   58   59   60   61   ...   67




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

    Main page