I've lost sudo access and I don't really understand why

Chris Green cl at isbd.net
Wed Mar 18 21:28:07 UTC 2020


On Wed, Mar 18, 2020 at 09:02:45PM +0000, Ian Bruntlett wrote:
>    On Wed, 18 Mar 2020 at 20:56, Chris Green <[1]cl at isbd.net> wrote:
> > 
> >    I'm running xubuntu 19.10 and I've somehow lost the ability to sudo
> >    to
> >    root.
> 
> OK, I am no expert on this sort of thing but... I think if you provide
> the output of the "groups" command, someone on this list will be able
> to help you out.
> BW,
> Ian

    chris at esprimo$ groups
    chris vboxusers
    chris at esprimo$ 

So I'm only a member of group vboxusers and I need to be a member of
sudo too.  However I still don't see why my usermod command removed
my sudo access.  Ah, oops, yes I do, looking at the usermod man
page it tells me:-

       -G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
           A list of supplementary groups which the user is also a member of. Each group is
           separated from the next by a comma, with no intervening whitespace. The groups are
           subject to the same restrictions as the group given with the -g option.

           If the user is currently a member of a group which is not listed, the user will be
           removed from the group. This behaviour can be changed via the -a option, which
           appends the user to the current supplementary group list.

So (unless using the -a option) usermod removes group membership that
isn't specifically stated.  Surely there's an easier way to add
oneself to an extra group.

Anyway I need to add myself back to group sudo.  Can I just boot into
single user mode, or boot from an installation disk, and edit
/etc/group or is there more to it than that?

-- 
Chris Green




More information about the ubuntu-users mailing list