Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: SamK on January 22, 2011, 07:52:25 AM

Title: Adding User tc to an Additional Group
Post by: SamK on January 22, 2011, 07:52:25 AM
While investigating a problem of writing to a mounted samba share I came across this.  It looks odd as the standard tc user appears to belong to different groups, depending upon how the question is asked.

List groups as user tc
Code: [Select]
tc@box:~$ id
uid=1001(tc) gid=50(staff) groups=50(staff),1000(audio)

List groups as user tc specifying user tc
Code: [Select]
tc@box:~$ id tc
uid=1001(tc) gid=50(staff) groups=50(staff),1000(audio)

Create a group and add user tc to the group
Code: [Select]
tc@box:~$ sudo addgroup -g 2001 testgroup
tc@box:~$ sudo addgroup tc testgroup

List groups as user tc
Code: [Select]
tc@box:~$ id
uid=1001(tc) gid=50(staff) groups=50(staff),1000(audio)

List groups as user tc specifying user tc
Code: [Select]
tc@box:~$ id tc
uid=1001(tc) gid=50(staff) groups=50(staff),1000(audio),2001(testgroup)

Is this normal and expected behaviour?
Title: Re: Adding User tc to an Additional Group
Post by: curaga on January 22, 2011, 01:36:52 PM
Probably needs to logout and login to fully refresh.
Title: Re: Adding User tc to an Additional Group
Post by: SamK on January 23, 2011, 06:29:32 AM
Probably needs to logout and login to fully refresh.
After a reboot

List groups as user tc
Code: [Select]
tc@box:~$ id
uid=1001(tc) gid=50(staff) groups=50(staff),1000(audio),2001(testgroup)

List groups as user tc specifying user tc
Code: [Select]
tc@box:~$ id tc
uid=1001(tc) gid=50(staff) groups=50(staff),1000(audio),2001(testgroup)

Prior to the reboot it was not possible to write to the Samba share, after the reboot it is.

It is preferable for this to be done without a reboot; perhaps a refresh similar to that provided by rebuildfstab might be considered for the future.
  
Title: Re: Adding User tc to an Additional Group
Post by: maro on January 23, 2011, 09:08:53 PM
I'd imagine it would be enough to: (1) terminate the X server (maybe via 'Ctrl-Alt-Backspace') and (2) terminate the "original" shell and then (3) login again (e.g. as user 'tc'). Or did you try that out already?
Title: Re: Adding User tc to an Additional Group
Post by: SamK on January 24, 2011, 04:08:17 AM
Probably needs to logout and login to fully refresh.
I'd imagine it would be enough to: (1) terminate the X server (maybe via 'Ctrl-Alt-Backspace') and (2) terminate the "original" shell and then (3) login again (e.g. as user 'tc').
It does work this way, even though slightly inelegant.
Title: Re: Adding User tc to an Additional Group
Post by: MSumulong on October 27, 2015, 12:02:43 PM
Probably needs to logout and login to fully refresh.

Is there a way to have the id/groups update without having to logout and log back in?
Title: Re: Adding User tc to an Additional Group
Post by: curaga on October 27, 2015, 12:45:45 PM
" The set of supplementary group IDs is inherited from the  parent process, and preserved across an execve(2)."

So no. If you need more groups, you should set them before the login, such as in bootsync.sh.
Title: Re: Adding User tc to an Additional Group
Post by: gerald_clark on October 27, 2015, 02:00:35 PM
You can also include group and gshadow in your backup.