How do I create an existing user sudo in Linux

Providing sudo (superuser) privileges to an existing user in Linux allows them to perform administrative tasks that require higher-level permissions. This guide will walk you through the steps to grant sudo privileges to an existing user in Linux, ensuring clarity and ease of understanding.

Key Terms Explained

  • Sudo: Short for “superuser do,” it allows a permitted user to execute commands as the superuser or another user, as specified by the security policy.
  • Root User: The administrative user in Linux with unrestricted access to all commands and files.
  • Usermod: A Linux command used to modify a user account.
  • Sudoers File: A configuration file that defines which users have sudo privileges and what commands they can run.


Before proceeding, make sure you have:

  1. Root or an existing sudo user access.
  2. Access to the terminal.

Step-by-Step Guide to Grant Sudo Privileges to an Existing User

1. Open the Terminal

You can open the terminal by searching for “terminal” in your applications menu or by using the shortcut Ctrl + Alt + T.

2. Add the User to the Sudo Group

To grant sudo privileges to an existing user, you need to add them to the sudo group. For example, to grant sudo privileges to a user named existinguser, run the following command:

sudo usermod -aG sudo existinguser


  • sudo: Executes the command with superuser privileges.
  • usermod: The command to modify a user account.
  • -aG: The -a option appends the user to the specified group(s), while the -G option specifies the group(s) to which the user is being added.
  • sudo: The group to which the user is being added.
  • existinguser: The username of the existing user.

3. Verify the User’s Sudo Privileges

To ensure the user now has sudo privileges, switch to the user account:

su - existinguser

Then, run a command with sudo to check if it executes correctly. For example:

sudo whoami


  • su - existinguser: Switches to the user account of existinguser.
  • sudo whoami: Runs the whoami command with sudo privileges to display the effective username. If the user has sudo privileges, the output will be root.

Additional Tips

  • Editing the Sudoers File: For specific sudo permissions, you can edit the sudoers file using the visudo command, which safely edits the file to prevent syntax errors.
  sudo visudo

Add the following line to grant specific command permissions:

  existinguser ALL=(ALL) NOPASSWD: /path/to/command


  • existinguser: The username of the user being granted specific sudo permissions.
  • ALL=(ALL) NOPASSWD: Allows the user to run the specified command without being prompted for a password.
  • /path/to/command: The specific command the user can run.
  • Removing Sudo Privileges: To remove sudo privileges from a user, use the deluser command:
  sudo deluser existinguser sudo


  • deluser: The command used to delete a user from a group.
  • existinguser: The username of the user.
  • sudo: The group from which the user is being removed.


Granting sudo privileges to an existing user in Linux is a straightforward process involving a few simple commands. By following this guide, you can effectively manage administrative privileges on your Linux system, ensuring both security and convenience. Proper management of sudo users helps maintain a secure and well-administered system, preventing unauthorized or accidental changes.