`adduser [options] user group` fails ubuntu 11.04

1

I'm want to use adduser However it doesn't seem to work if I provide the second argument for the user's group

root@a:~# adduser rick staff
adduser: The user `rick' does not exist.

The group exists

root@a:~# addgroup staff
addgroup: The group `staff' already exists.

The man page says this should work...

adduser [options] user group

Any ideas?

I can do:

adduser --ingroup staff rick

So no massive issue, just seems strange.

Rob

Posted 2011-11-11T16:31:40.667

Reputation: 649

Could you pastebin man adduser? Seems odd... – Pricey – 2011-11-11T16:38:35.223

Answers

3

Rob, re-read the error message from adduser command: The user rick does not exist.. Later you write about group staff, which does exist. But adduser failed because user rick does not exist yet.

Matej Kovac

Posted 2011-11-11T16:31:40.667

Reputation: 366

you're right, my bad, it's not clear from the man page but what im trying to run requires an existing user, so using --ingroup is what I want. – Rob – 2011-11-14T11:02:55.867

2

If you are trying to add an user and add this user to a group, you should:

adduser newuser
usermod -aG thegroup newuser

If thegroup isn't yet created, you should create it before the usermod:

groupadd thegroup

ata

Posted 2011-11-11T16:31:40.667

Reputation: 141

Thanks for the answer but I know how, im asking why the documented method of adduser does not work – Rob – 2011-11-11T17:24:10.620

1@Rob perhaps you are lookin for --gid or --ingroup ? – ata – 2011-11-11T18:27:18.147

As per my original question, --ingroup works fine, this is nothing to do with groups, I'm trying to raise that there's an issue with adduser [options] user group – Rob – 2011-11-14T10:56:30.607