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


[root@rhel-instance ]# usermod -U usertest



Download 1.85 Mb.
View original pdf
Page59/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   55   56   57   58   59   60   61   62   ...   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
]# usermod -U usertest

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

usertest:$6$4PEVPj7M4GD8CH.4$VqiYY.
IXetwZA/g54bFP1ZJwQ/yc6bnaFauHGA1 1eFzsGh/
uFbJwxZCQTFHIASuamBz.27gb4ZpywwOA840eI.:19062:0:99999:7:3:21
915:
Now, you can see that the ! character is removed. Feel free to try logging in again.
Important Note
To fully lock the account from access, not just from logging in with a password (there are other mechanisms, we should set the expiry date to Another common use case is when you want users to access the system, such as having a network shared directory (that is, via NFS or CIFS, as explained in Chapter 12, Managing Local Storage and
Filesystems), but you do not want them to be able to run commands in the system. For that, we can use a very special shell – the nologin shell. Let’s assign that shell to the usertest user account using usermod:
[root@rhel-instance
]# usermod -s /sbin/nologin usertest

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

usertest:x:1001:1001::/home/usertest:/sbin/nologin
[root@rhel-instance
]# su - usertest

This account is currently not available.
[root@rhel-instance
]# usermod -s /bin/bash usertest


Securing Systems with Users, Groups, and Permissions
148
[root@rhel-instance
]# su - usertest

[usertest@rhel-instance
]$

Note that we are reviewing the changes in /etc/passwd this time, as it is where the modification is applied.
As you can see, it’s easy to set the values for password aging for any user, lock them, or restrict access to the system. Let’s move onto more administrative tasks and how to delegate admin access.
Configuring sudo access for administrative tasks
There is away to delegate administrative access to users in RHEL, and it is done with a tool called

Download 1.85 Mb.

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




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

    Main page