122

If you give a user sudo privileges how can I remove the sudo privileges and make the user become just a regular user?

I used:

sudo adduser username sudo

Now I've changed my mind.

guntbert
  • 13,475
Joe C
  • 1,385

4 Answers4

141

Just type

sudo deluser username sudo

This will remove the user named username from the group sudo.

Be careful not to remove the real adminuser from the sudo group.

guntbert
  • 13,475
60

If you're like me, you are just trying to figure out how to take away sudo access from a user. It's easy, just open sudo, and type the following in. Keep in mind that USERNAME can be replaced by the profile you are doing this to. In terminal type:

sudo deluser USERNAME sudo

This will only take sudo access away from the profile named USERNAME, and will not delete!

David Foerster
  • 36,890
  • 56
  • 97
  • 151
Plane Guy
  • 650
  • 6
  • 2
14

You can also use gpasswd:

sudo gpasswd -d username sudo

This will remove username from group sudo.

Shayan
  • 451
1

In Ubuntu 22.04 cloud image none of the above worked. I had to also remove the default ubuntu user from file: /etc/sudoers.d/90-cloud-init-users

maiky
  • 188