Prompt Title: add newuser

Created 1 year ago
Votes 0
Views 132 times
0

Prompt Detail:

Here are the steps to create a new non-root user with their own home directory and sudo privileges:

  1. Log in to the server as the root user or a user with sudo privileges.

  2. Create a new user account using the following command, replacing "newusername" with the desired username:

    adduser newusername
  3. Set a password for the new user when prompted.

  4. Create a new directory for the user's home directory with the following command, replacing "newusername" with the desired username:

    arduino
    mkdir /home/newusername
  5. Set the correct permissions for the new home directory with the following command:

    bash
    chmod 755 /home/newusername
  6. Change the ownership of the new home directory to the new user with the following command, replacing "newusername" with the desired username:

    bash
    chown newusername:newusername /home/newusername
  7. Grant sudo privileges to the new user by adding them to the "sudo" group with the following command:

    usermod -aG sudo newusername
  8. Log out of the root or sudo user account.

  9. Log in to the server with the new username and password.

  10. Test sudo privileges by running a command with sudo, such as:

    bash
    sudo ls -la /root

    You should be prompted for your password and then see the contents of the root directory.

That's it! You have successfully created a new non-root user with their own home directory and sudo privileges.

avatar
nags
Shared 3 prompts
Created 1 year ago

Leave a Comment

Related Tag Prompts

0
0
another1 related useradd
1 year ago 2023-04-13 11:59:33 nags
0
0
Ansible
11 months ago 2023-05-16 11:30:00 Envy
0
0
RPM Summary Script
9 months ago 2023-07-12 19:27:33 Anthony Barnett
0
0
Help Request Received
9 months ago 2023-07-23 17:22:49 PraveenKumar