WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Adding User tc to an Additional Group  (Read 5078 times)

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Adding User tc to an Additional Group
« 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?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Adding User tc to an Additional Group
« Reply #1 on: January 22, 2011, 01:36:52 PM »
Probably needs to logout and login to fully refresh.
The only barriers that can stop you are the ones you create yourself.

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: Adding User tc to an Additional Group
« Reply #2 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.
  
« Last Edit: January 23, 2011, 06:43:19 AM by SamK »

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Adding User tc to an Additional Group
« Reply #3 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?

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: Adding User tc to an Additional Group
« Reply #4 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.

Offline MSumulong

  • Newbie
  • *
  • Posts: 25
Re: Adding User tc to an Additional Group
« Reply #5 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?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Adding User tc to an Additional Group
« Reply #6 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.
The only barriers that can stop you are the ones you create yourself.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Adding User tc to an Additional Group
« Reply #7 on: October 27, 2015, 02:00:35 PM »
You can also include group and gshadow in your backup.