I am a newbie on linux. I followed an example from manpage I ran from linux platform in regards to how to create user/group and add a user to a group but when I ran id command output didn't reflect what I expected.

This is what I did.

  1. sudo su -
  2. groupadd profilers (created new group name profilers)
  3. adduser user1 (created new user name user1)
  4. passwd user1 (set password for user1 account)
  5. useradd -G profilers user1 (add user1 to group name profilers)
  6. id user1
  7. uid=526(user1) gid=527(user1) groups=527(user1)

I thought gid and groups would be profilers but not. I am not sure what is happening. Also I tried this command (useradd -g profilers user1) but output was same...


I tried with "usermod -a -G groupName userName" command for user1 account and this is output.

uid=526(user1) gid=527(user1) groups=527(user1),526(profilers)

Another question came to me, why gid is set to user1? I thought gid=group id so it should point to profilers (groupName).

  • Have you seen this page? wiki.archlinux.org/index.php/Users_and_groups It applies to all Linux distros, not just Arch Linux. If anything specific is still unclear after reading this, you may edit your own question. Dec 2, 2015 at 17:53
  • I will read the doc. Thank you for pointing out to me.
    – DaeYoung
    Dec 2, 2015 at 19:15

1 Answer 1


The useradd command creates a new user or updates default new user information. It is not used to modify existing users. To add a user to another secondary group, you will need to user a command like the usermod command:

usermod -a -G profilers user1

As for why the gid is set to user1, this is because a default user's primary group is a group with the same name as the user. Each user has a single primary group and one to many secondary groups. Adding secondary groups will allow more access to folders, but changing the primary group has further reaching implications and should only be done for specific cases that require doing so.

To change a user's primary group, you can use this usermod command:

usermod -g profilers user1
  • 1
    Thank you for broadening my understanding on this subject!
    – DaeYoung
    Dec 2, 2015 at 19:15
  • that doesnt' work in arch
    – chovy
    2 days ago

You must log in to answer this question.

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