Create new user centos

Here are the steps to create a new user on a CentOS system:

Method 1: Using the useradd command

  1. Open a terminal as the root user (or use sudo to elevate your privileges).
  2. Type the following command to create a new user: useradd <username>
    • Replace <username> with the desired username for the new user.
  3. Set the password for the new user using the passwd command: passwd <username>
    • Enter a password for the new user, and then confirm it.
  4. Verify that the new user has been created by running the id command: id <username>

Method 2: Using the adduser command (CentOS 7 and later)

  1. Open a terminal as the root user (or use sudo to elevate your privileges).
  2. Type the following command to create a new user: adduser <username>
    • Replace <username> with the desired username for the new user.
  3. Set the password for the new user using the passwd command: passwd <username>
    • Enter a password for the new user, and then confirm it.
  4. Verify that the new user has been created by running the id command: id <username>

Additional options

You can also specify additional options when creating a new user, such as:

For example:

useradd -m -s /bin/bash -G wheel <username>

This would create a new user with a home directory, use the Bash shell, and add the user to the wheel group.

Verify the new user

Once you've created the new user, you can verify that they exist by running the id command:

id <username>

This should display information about the new user, including their username, user ID, and group membership.

That's it! You should now have a new user on your CentOS system.