How Do I Assign a User to Sudo in Linux?
Contents

How do I add a user to sudo in Linux?

Steps to create a new sudo user on Ubuntu

  1. First add the user, run: sudo adduser <UserNameHere>
  2. Add the user to sudo group by typing the command in terminal for Ubuntu version 12.04 and above: sudo adduser <UserNameHere> sudo.
  3. In older version of Ubuntu (version 12.04 and older), run: sudo adduser <UserNameHere> admin.

How do I change user to sudo?

Another way to switch to another account with sudo is to use the -s option. If you run sudo -s that will start a shell as root. You can specify a user with the -u option.
…
Using sudo.

Commands Meaning
sudo -u root command Run command as root.
sudo -u user command Run command as user.
Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest