9

I need to add an user called "admin". When I type:

# adduser admin

I get:

adduser: The group 'admin' already exists.

So, I guess, by default, adduser is trying to create an "admin" group that already exist at the same time as creating the "admin" user. Reading adduser man page I've seen -N option to avoid goup creation. I tried this:

adduser -N admin

With the same result. How can I create an "admin" user?

Zanna
  • 70,465
aitor
  • 291
  • I can create a user named admin in 16.04 though – Anwar Oct 15 '16 at 17:39
  • I can't find any reference to a -N option, however you should be able to use either --ingroup GROUP to set the new user's primary group to an existing group GROUP, or --group GROUP to set the new user's primary group to a non-preexisting group GROUP, overriding creation of the default user private group. – steeldriver Oct 15 '16 at 17:54
  • as far as i know, admin is a system account and is created by default. It's not assigned to any particular user. You could make a different account, admin1 though. That's what i personally did – Sergiy Kolodyazhnyy Oct 15 '16 at 18:05
  • --ingroup did the trick, thank you very much. For -N option reference: http://manpages.ubuntu.com/manpages/trusty/en/man8/useradd.8.html -N, --no-user-group Do not create a group with the same name as the user, but add theuser to the group specified by the -g option or by the GROUP variable in /etc/default/useradd. – aitor Oct 15 '16 at 18:08

2 Answers2

9

As steeldriver suggest, this works:

# adduser admin --ingroup sudo
aitor
  • 291
0

You should never create a user called exactly "admin". On many distributions this user exists and is used for system purposes. Some applications may refer to it too. If you create this user he may have unrestricted root-like system access through security settings in some scripts. If you try to alter this user's rights some applications will stop working.

  • Ok. Thanks for the advice. I need to do it in this case due to an environment requeriments. – aitor Oct 15 '16 at 18:29
  • Then at least mention that you did that when asking fiurther questions if something on the system does not work. – Barafu Albino Oct 15 '16 at 18:30
  • Can you clarify this comment, Barafu? Maybe, I have no much skills in english language. Sorry. – aitor Oct 15 '16 at 18:34
  • I say "If something on that system not works and you ask questions about it, you must state that you created admin user and what you did with it, because it may be the cause of malfunction". – Barafu Albino Oct 15 '16 at 18:41
  • Ok, I understand. This issue happens in a fresh installation of Ubuntu 14.04.5. Create this "admin" user is the first thing I'm doing with Ubuntu. So, I did nothing with the user and the OS yet. – aitor Oct 15 '16 at 18:46
  • This would be better posted as a comment. – Rinzwind Oct 15 '16 at 19:45