Hi,
On 23 April 2010 08:52, Chris Adams <cmadams(a)hiwaay.net> wrote:
Once upon a time, Suvayu Ali <fatkasuvayu+linux(a)gmail.com>
said:
> I have never properly understood the leading bit in permissions. (the 0
> in the 0755) Could you point me to some easily understandable resource?
The leading 3 bits is essentially an add-on to each of the user, group,
and other sections. For user and group, the corresponding bit is the
set-id bit. For executable filess with the set-user-id bit (e.g. 4xxx)
or set-group-id bit (e.g. 2xxx) set, the executable runs as the files
owner or group, not the calling user or group.
For directories, set-group-id means that new entries in that directory
inherit the group from the directory instead of the calling group.
The bit corresponding to other (e.g. 1xxx) is called the "sticky" bit.
On directories (such as /tmp), it means that only users/groups with
permissions to a file can delete it.
After reading your response I knew more precisely what to look for and
after some searching and looking @ `info coreutils "File permissions"
"Mode Structure", I think I understand them now.
However I failed to find how to see whether any of those bits are set
for a file. I tried `ls -l ' in /bin, /usr/bin, and /tmp but didn't
notice anything obvious. I also failed to find any appropriate option
for ls to list it either. Am I looking in the wrong place?
Also in what situations would seting the setuid or setgid bits help? I
could think of some, like writing configuration files for the
application which are otherwise owned by someone else, maybe for a web
server or a daemon or maybe some automated backup solution. Are these
valid scenarios?
In old Unix, the sticky bit on an executable changed the way the
kernel
paged it into and out of RAM, but I don't believe Linux uses it.
--
Chris Adams <cmadams(a)hiwaay.net>
--
Suvayu
Open source is the future. It sets us free.