Jump to content

How to Add New Users to Linux

From freem


Adding new users to a Linux system is a common task for system administrators or users who want to grant access to other people to use the system. Here are the general steps to add new users to a Linux system:

1. Open a terminal window and log in as the root user or a user with sudo privileges. 2. Use the `adduser` command to add a new user. For example, to add a user named "johndoe", type the following command and press Enter:

  ```
  adduser johndoe
  ```
  You will be prompted to enter the new user's password and some other information such as full name, phone number, etc. You can choose to skip some of the fields by pressing Enter.

3. After you have provided the required information, a new user account will be created with the username and home directory. The home directory for the new user will be created under the /home directory. 4. To grant administrative privileges to the new user, you can add the user to the sudo group by typing the following command and press Enter:

  ```
  usermod -aG sudo johndoe
  ```
  This will add the user "johndoe" to the sudo group, which allows them to execute commands with root privileges using the `sudo` command.

5. Finally, you can test the new user account by switching to the user's account by typing the following command and press Enter:

  ```
  su - johndoe
  ```
  This will switch to the new user's account and you can test that everything is working correctly.

That's it! You have successfully added a new user to your Linux system.