1

How to change primary user group of a user? Preferably without losing the current primary group altogether as the user is part of 'staff' ie. admin. I suppose I could create another admin user and then recreate the original user, but is there a simpler way?

Illotus
  • 457
  • 4
  • 9

2 Answers2

4

Use usermod(1M):

# usermod -g PRIMARY_GROUP -G SECONDARY_GROUP username
alanc
  • 1,500
  • 9
  • 12
gtirloni
  • 5,746
  • 3
  • 25
  • 52
1

Have you tried the newgrp command?

alanc
  • 1,500
  • 9
  • 12
Muhammad
  • 699
  • 10
  • 20
  • newgrp changes the group for just the current login session, usermod as suggested by @gtirloni changes the default groups defined in the passwd and group files for all future logins. – alanc Sep 02 '12 at 08:08