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


[root@rhel-instance ]# useradd user01



Download 1.85 Mb.
View original pdf
Page52/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   48   49   50   51   52   53   54   55   ...   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
]# useradd user01

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

user01:x:1001:1001::/home/user01:/bin/bash
[root@rhel-instance
]# id user01

uid=1001(user01) gid=1001(user01) groups=1001(user01)
With that, the user is created.
Important Note
To be able to add users, we need administrative privileges. In the current configuration, we do that by running the commands as root.
The account is created using the default options configured in the system, such as the following No password assigned: The new user will not be able to login using a password. However, we can switch to that account by using su as root. We will see how to add a password to the user next User ID (UID): The first number over 999 available. In the command we ran before, for user, the UID is 1001.
Group ID (GID): The same number as the UID. In this case, the GID is 1001.
Description: No description is added when creating the user. This field is left empty Home: A home directory is created in /home/$USER – in this case,/home/user01. This will be the default and main directory for the user and is where their personal preferences and files will be stored. Initial contents are copied from /etc/skel.
Shell: The default shell is bash.
Tip
The default options applied when anew user is created are defined in the /etc/default/
useradd file.

Creating, modifying, and deleting local user accounts and groups
139
Once the user is created, we can add (or change) the password by running, as root, the command passwd followed by the username to change it:
[root@rhel-instance
]# passwd user01

Changing password for user user01.
New password redhat
BAD PASSWORD The password is shorter than 8 characters
Retype new password redhat

Download 1.85 Mb.

Share with your friends:
1   ...   48   49   50   51   52   53   54   55   ...   67




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

    Main page