`sudo adduser username admin` leads to `adduser: The group `admin' does not exist.`

11,737

Solution 1

The complaint about "admin" being nonexistant is unrelated to what's in the sudoers file. It is referring to usergroup, as listed in /etc/group.

To create a group named admin, type sudo groupadd admin. After that, your command as listed should function as intended. You of course only need to create the admin group once.

To add an existing user to the admin group:

usermod -a -G admin username (personally I like to just edit /etc/group, bet that's probably frowned upon. I've been doing it for decades and don't care about frowns).

For more info: man group and man usermod

Solution 2

You created a new user with the username username NOT what you appear to have syntax would be :

sudo useradd admin

sudo usermod {Some Options}  admin   

// second command changes the defaults (/home/USERNAME, passwd,etc) which unless declared otherwise in previous command will

Share:
11,737

Related videos on Youtube

kramer65
Author by

kramer65

Updated on September 18, 2022

Comments

  • kramer65
    kramer65 over 1 year

    I'm trying to add a user to the sudoers file with the simple command

    sudo adduser username admin
    

    but I get adduser: The group 'admin' does not exist. So I checked out the sudoers file (sudo visudo -f /etc/sudoers), which contains among others, this line:

    %admin ALL=(ALL) ALL
    

    which as far as I know means that the admin group exists.

    So what am I missing here?