How to Create a new user account in CentOS 7/8/9

https:/‮.www/‬lautturi.com
How to Create a new user account in CentOS 7/8/9

To create a new user account in CentOS 7/8/9, you can use the useradd command. The useradd command is a standard Unix command that is used to create a new user account on the system.

  1. Log in to your CentOS system as the root user.

  2. Run the useradd command with the desired username as an argument. For example, to create a new user account with the username myuser, you can use the following command:

useradd myuser

This will create a new user account with the default settings, including a default home directory and a default group.

  1. Set a password for the new user account using the passwd command. For example:
passwd myuser

Follow the prompts to enter and confirm the password for the user.

  1. To customize the settings for the new user account, you can use the usermod command. For example, to set the user's full name and add the user to additional groups, you can use the following command:
usermod -c "Full Name" -a -G group1,group2 myuser

This will set the user's full name to "Full Name" and add the user to the group1 and group2 groups.

  1. To set the user's login shell, you can use the -s option. For example, to set the user's login shell to bash, you can use the following command:
usermod -s /bin/bash myuser
  1. To delete a user account, you can use the userdel command. For example:
userdel myuser

This will delete the user account and the user's home directory.

Keep in mind that you will need to have appropriate privileges to create, modify, and delete user accounts on the system. You may need to use the sudo command to gain sufficient privileges.

Created Time:2017-10-16 14:38:44  Author:lautturi