Add User and Set Password in Linux

To add a user and set a password on a Linux system, you can follow these steps:

  1. Open the terminal window and enter the following command to switch to superuser (root) permissions:
sudo su
  1. Use the following command to add a new user (for example, with the username newuser):
useradd newuser
  1. To set a new password for a new user, use the following command:
passwd newuser

The system will prompt you to enter a new password twice to confirm.

  1. To add new users to other user groups, you can use the following command:
usermod -aG groupname newuser

Please replace “groupname” with the name of the user group you want to add.

  1. Finally, exit the root superuser privileges.
exit

Now that you have successfully added a new user and set up a password, you can log in to the system using the new user.

bannerAds