How do I create an existing user sudo in Linux?

Granting sudo (superuser) privileges to an existing user in Linux allows them to execute commands with administrative rights. This is essential for performing system-wide changes and managing administrative tasks. This guide will walk you through the process of granting sudo privileges to an existing user on a Linux system.

Why Grant Sudo Privileges to an Existing User?

Granting sudo privileges to an existing user can be necessary for several reasons:

  • Administrative Access: Allows a trusted user to perform system maintenance and administrative tasks.
  • Security: Limits the number of users with full root access while providing necessary permissions to specific users.
  • Convenience: Enables users to execute commands requiring superuser privileges without logging in as the root user.


Before you begin, ensure you have:

  1. Root or 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 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, use the following command:

sudo usermod -aG sudo existinguser

This command modifies the user account to append (-a) the user to the sudo group (-G).

3. Verify the User’s Sudo Privileges

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

su - existinguser

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

sudo whoami

If the setup is correct, the output should be root.

Additional Tips

  • Granting Specific Sudo Permissions: You can provide specific sudo permissions by editing the sudoers file with the visudo command. For example, to allow existinguser to run a specific command without a password:
  sudo visudo

Add the following line:

  existinguser ALL=(ALL) NOPASSWD: /path/to/command
  • Removing Sudo Privileges: To remove sudo privileges from a user, use the following command:
  sudo deluser existinguser sudo
  • Testing Sudo Access: Always test the sudo access of the user to ensure the changes have been applied correctly. You can do this by logging in as the user and running a few sudo commands.


Granting sudo privileges to an existing user in Linux is a straightforward process that involves adding the user to the sudo group. By following this guide, you can efficiently manage administrative privileges on your Linux system, ensuring both security and convenience. Properly managing sudo users helps maintain a secure and well-administered system, preventing unauthorized or accidental changes.