3

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?

2 Answers 2

8

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

1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .