Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Mar 2011 09:55:00 +0100
From:      David Demelier <demelier.david@gmail.com>
To:        Robert Bonomi <bonomi@mail.r-bonomi.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Question about nethack and setgid
Message-ID:  <4D6F5764.6000109@gmail.com>
In-Reply-To: <201103030149.p231n00R054900@mail.r-bonomi.com>
References:  <201103030149.p231n00R054900@mail.r-bonomi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 03/03/2011 02:49, Robert Bonomi wrote:
>> Date: Wed, 02 Mar 2011 23:51:45 +0100
>> From: David Demelier<demelier.david@gmail.com>
>> To: freebsd-questions@freebsd.org
>> Subject: Question about nethack and setgid
>>
>> Hello,
>>
>> I don't understand how nethack can store the score in
>> /usr/local/lib/nethack/logfile.
>>
>> the real binary is here /usr/local/lib/nethack/nethack
>>
>> And the mode is
>>
>> -rwxr-sr-x  1 games  games  1793635 25 Jan 2011
>> /usr/local/lib/nethack/nethack
>>
>> So that means people in games group will run nethack as games user (owner
>> of file)
>
> Actually, it means that the program will run with the _group_ id of the
> file -- i.e. the 'games' group.  _That_ 's' is the 'sgid' or 'set groupID'
> bit.
>
>>          but I'm not in games group ! and I can save the file located in
>>
>> /usr/local/lib/nethack/logfile which mode is -rw-rw-r--  games  games
>
> Lo and behold!  The file _is_ writable by the games group.
>
>> I'm writing a game that will store file too, because I can't make it
>> works like nethack I was planning using the setuid mode but I don't like
>> much this ..
>>
>> What am I misunderstanding?
>
> the function of the 'setgid' bit.<grin.

Okay, that's why the program was running on my user but with games 
group. I didn't see that the file was writable by games group neither. I 
understand everything now and my game is working too :-)

Thanks,

>>
>> Cheers,
>>
>> --
>> David Demelier
>> _______________________________________________
>> freebsd-questions@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions To
>> unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>>


-- 
David Demelier



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D6F5764.6000109>