Make new user linux

Here's a step-by-step guide to create a new user account on a Linux system:

Method 1: Using the useradd command

  1. Open a terminal as the root user (or use sudo to gain root privileges).
  2. Type the following command to create a new user account:
    useradd <username>

    Replace <username> with the desired username for the new account.

For example:

useradd john

This will create a new user account with a default home directory and shell.

Method 2: Using the adduser command (Ubuntu-based systems)

  1. Open a terminal as the root user (or use sudo to gain root privileges).
  2. Type the following command to create a new user account:
    adduser <username>

    Replace <username> with the desired username for the new account.

For example:

adduser john

This will create a new user account with a default home directory and shell.

Method 3: Using the usermod command (to create a new user and set password)

  1. Open a terminal as the root user (or use sudo to gain root privileges).
  2. Type the following command to create a new user account and set the password:
    usermod -m -s /bin/bash -c "New User" <username>

    Replace <username> with the desired username for the new account.

For example:

usermod -m -s /bin/bash -c "New User" john

This will create a new user account with a default home directory, set the shell to /bin/bash, and set the password.

Setting the password

After creating the new user account, you'll need to set the password. You can do this using the passwd command:

passwd <username>

Replace <username> with the desired username for the new account.

For example:

passwd john

This will prompt you to enter a new password for the new user account.

Additional settings

You can customize the new user account by setting additional settings, such as:

For example:

usermod -d /home/john -s /bin/bash -aG wheel john

This will set the home directory to /home/john, set the shell to /bin/bash, and add the user to the wheel group.

That's it! You've successfully created a new user account on your Linux system.