10

Possible Duplicate:
Is there a way in Linux to update the user/group properties without having to login again?

How does one refresh the groups that a logged-in user is in without having to re-login?

marked as duplicate by slhck Jan 14 '13 at 16:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    fyi. the answer marked correct is wrong... and it's still technically a relogin. I added a correct answer... I find that the answer given to this question is usually wrong. it is a common fallacy. – xenoterracide Apr 25 '10 at 1:49
18

possible in shell (I don't think it is for gui)

try newgrp groupname

I wrote more info on this on my blog a while back. according to that this will also change the default group of the shell. you can use sg to Switch your default Group

  • 2
    this is essentially no different that doing su - username as ignacio pointed out. a new shell process gets loaded and layered on top of the old one. however, you are still technically correct :) – moo Apr 25 '10 at 13:31
  • 3
    Prefix with exec (exec newgrp groupname) if you don't want to have an old shell process laying around. – grawity Apr 25 '10 at 15:24
  • 1
    @orlandu63 except su changes your user and the - means change your whole env too. It also can mean you have to login. newgrp doesn't. @grawity I didn't know that. thanks for the tip. – xenoterracide Apr 26 '10 at 1:16
7

su - username will do it for the shell (and subproccesses) that su opens up, but for everything else you'll need to relog.

  • 1
    this answer is incorrect especially since su is re-logging in. use newgrp in an open shell session to add groups to that session, that you've been added to. – xenoterracide Apr 25 '10 at 1:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.