How to remove user from being sudoer user in linux

How to remove user from being sudoer user in linux

  • Find out user group identity
    $ #Syntax: id -nG {user-name}
    $ id -nG foo
    $ #OUTPUT: admin foo printer audio

    by default admin and sudo groups are allowed to use sudo command as shown in /etc/sudoers file

  • Now to remove a user from group, you have to user usermod command
    $ #Syntax: usermod -G {groupname1,groupname2,...} {username}
    $ #For example, to keep membership of foo in printer and foo groups only 
    $ #(and remove him from admin and audio groups) run this:
    $ usermod -G foo, printer foo
    $ id -nG foo
    $ #OUTPUT: foo printer
    
  • finally restart sudo service
    $ service sudo restart
    

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site is using the Seo Wizard plugin created by http://seo.uk.net/