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
passwd: all authentication tokens updated successfully Now, the user has the new password assigned. Note two things The root user can change the password to any user without knowing the previous one (a full password reset. This is useful when a user comes back from their holidays and doesn’t remember their password In the example, we show the password assigned, redhat, but that is not shown on the screen. The password is too simple and does not meet the default complexity criteria – however, as root we can still assign it. Let’s check the new user with the id command we learned before: [root@rhel-instance ]# id user01 uid=1001(user01) gid=1001(user01) groups=1001(user01) After the steps taken in this section, we now have the user in the system and ready to be used. The main options we could have used to customize the user creation with useradd are the following -u or --uid: Assign a specific UID to the user -g or --gid: Assign a main group to the user. It can be specified by number (GID) or by name. The group needs to be created first -G or -groups Make the user part of other groups by providing a comma-separated list of them -cor -comment Provide a description for the user, specified between quotes if you want to use spaces -d or --home-dir: Define the home directory for the users or -shell Assign a custom shell to the user -p or -password Away to provide a password to the user. The password should be already encrypted to use this method. It is not recommended to use this option, as there are ways to capture the encrypted password. Please use passwd instead -r or -system To create a system account instead of a user account.
Securing Systems with Users, Groups, and Permissions 140 What if we need to change any of the user’s properties, such as, for example, the description The tool for that is usermod. Let’s modify the description to user01: [root@rhel-instance ]# usermod -c "User 01" user01