# Changing an existing user, in a new group and new user



## ColombianoAustralia (May 10, 2020)

Hello There,

I got a quick question, and if you know that it has been resolved previously, please point me on the right direction. All I am trying to do is to change a file's group using chgrp. I have done following.

* Create group music: "pw groupadd music"
* Add "freebsd" user to music group "pw groupmod music -M freebsd"
* Execute id "username", can see that "freebsd" belongs to music group "uid=1001(freebsd) gid=1001(freebsd) groups=1001(freebsd),0(wheel),1002(music)"
* Execute chgrp "chgrp music heart.final" with following error : "chgrp: you are not a member of group music"

Now I have executed "groups", though I do not understand why it is different when I executed like "groups" and "groups freebsd" 

* groups -> freebsd wheel
* groups freebsd  -> freebsd wheel music

What am I doing wrong?

Cheers
ColombianoAustralia


----------



## tingo (May 10, 2020)

you need to log out and in again after adding / changing groups for it to be updated in your session - that's why `groups` and `groups username` shows different.


----------



## ColombianoAustralia (May 11, 2020)

tingo said:


> you need to log out and in again after adding / changing groups for it to be updated in your session - that's why `groups` and `groups username` shows different.



Spot on mate!! thank you very much.


----------

