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


[root@rhel-instance ]# adduser usertest



Download 1.85 Mb.
View original pdf
Page57/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   53   54   55   56   57   58   59   60   ...   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
]# adduser usertest

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

usertest:!!:19062:0:99999:7:::
Important Note
adduser and useradd have similar functionality in RHEL 9. Feel free to type it the way you feel most comfortable.
You’ll notice in the previous example from the two exclamation marks (!!) in bold that the password is not set and we are using the defaults. Let’s change the password and check the difference. Use any password you like:
[root@rhel-instance
]# passwd usertest

Changing password for user usertest.
New password:

Adjusting password policies
145
Retype new password:
passwd: all authentication tokens updated successfully.
[root@rhel-instance
]# grep usertest /etc/shadow

usertest:$6$4PEVPj7M4GD8CH.4$VqiYY.
IXetwZA/g54bFP1ZJwQ/yc6bnaFauHGA1 1eFzsGh/
uFbJwxZCQTFHIASuamBz.27gb4ZpywwOA840eI.:19062:0:99999:7:::
The password hash is created and the date for the last change is just kept the same as the current date. Lets establish some options:
[root@rhel-instance
]# chage --mindays 0 --warndays 7

--inactive 3 --expiredate 2030-01-01 usertest
[root@rhel-instance
]# grep usertest /etc/shadow

usertest:$6$4PEVPj7M4GD8CH.4$VqiYY.IXetwZA/g54bFP1ZJwQ/
yc6bnaFauHGA1 1eFzsGh/uFbJwxZCQTFHIASuamBz.27gb4ZpywwOA
840eI.:19062:0:99999:7:3:21915:
[root@rhel-instance
]# dated UTC + 21915 days'

Tue Jan 1 01:00:00 AM CET 2030
Please notice the changes in the /etc/shadow file corresponding to the values specified for chage. We can check the changes with the l option for chage:
[root@rhel-instance
]# chage -l usertest

Last password change : mar 11, 2022
Password expires : never
Password inactive : never

Download 1.85 Mb.

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




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

    Main page