Creating a Non-root User with Sudo Access on Ubuntu

Published on Author craigzearfossLeave a comment
  • Add a new user.
    sudo useradd <username>
  • Add a sudo entry.
    sudo visudo

    Below the section heading # User privilege specification add the following entry.

    <username> ALL=(ALL:ALL) ALL
  • Create the home folder

    sudo mkdir /home/<username>
    chown <username>:<usergroup> /home/<username> -R
  • Set the password for the user.

    sudo passwd <username>
  • Add the following entry to the /etc/passwd file.

  • Reboot the server for the changes to take effect.

    sudo reboot


Leave a Reply

Your email address will not be published. Required fields are marked *