Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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
add comment

2 Answers

up vote 14 down vote accepted

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

share|improve this answer
1  
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
2  
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
add comment

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

share|improve this answer
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
add comment

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