I'm afraid the command was working as expected.

% sudo chmod g+s $(which id)           

% id -g

0


% sudo chmod g-s $(which id)

% id -g                     

100


Regards,
Siva Chidambaram Somu

On Tue, Aug 30, 2016 at 9:03 AM, Mihai Moldovan <ionic@ionic.de> wrote:
On 29.08.2016 11:33 AM, Sivachidambaram Somu wrote:
> My bad. I have given below the output of the mount command on my machine.
>
> %mount
>
> /dev/xvda1 on / type auto (rw,noatime)
>
> proc on /proc type proc (rw)
>
> sysfs on /sys type sysfs (rw)
>
> devpts on /dev/pts type devpts (rw,gid=5,mode=620)
>
> tmpfs on /dev/shm type tmpfs (rw)
>
> /dev/mapper/ephemeralVG-ephemeral on /local type ext4 (rw)
>
> none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
>
> fusectl on /sys/fs/fuse/connections type fusectl (rw)

Okay, no "nosuid" option in there, so that's also ruled out.


As a test, set the setgid bit on the id binary like this:

sudo chmod g+s $(which id)

then, as a non-root user(!) run:

id -g

Make sure to disable the setgit bit again with:

sudo chmod g-s $(which id)


If the previous id -g call returned an effective group ID of 0, that means that
setgid functionality should be working on your system. If it's not 0, the reason
for your problems are likely that setgid on files is not working correctly on
your system.



Mihai