How to add user accounts in CentOS 8

< Install CentOS 8 | Configure firewall and SELinux >

Here's how to add another user account in CentOS 8.

[root@localhost ~]# useradd newuser
[root@localhost ~]# passwd newuser
Changing password for user newuser.
New UNIX password:             # Input whatever password you want.
Retype New UNIX password:      # Confirm.
passwd: all authentication tokens updated successfully.

You might also need to switch to the root account on occasion, you can use the su command to do this.

localhost login: newuser
password:                      # obviously, put your password here.
[newuser@localhost ~]# su -    # "su" stands for "substitute user", and in this case we are switching to root
password:                      # Enter the root password here.
[root@localhost ~]#

You can delete users like this:

[root@localhost ~]# userdel newuser # deletes the account "newuser". It only removes the user account, not the home directory

# To remove the home directory too, you'd run the command like this:
[root@localhost ~]# userdel -r newuser

< Install CentOS 8 | Configure firewall and SELinux >