On 23 April 2010 12:39, Chris Adams <cmadams(a)hiwaay.net> wrote:
Once upon a time, suvayu ali <fatkasuvayu+linux(a)gmail.com>
said:
> 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?
Run "ls -ld /tmp" and you should see:
drwxrwxrwt. 17 root root 4096 2010-04-23 14:37 /tmp
The "t" at the end (instead of a normal "x") indicates the directory
sticky bit.
I was looking at the contents and not /tmp itself. :-p I also looked
at /bin/su and /usr/bin/passwd, they have `-rwsr-xr-x' as permissions.
:)
> 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?
You should only have setuid/setgid for programs that are designed for
privilege escalation (such as /bin/su and /usr/bin/passwd). Setting
them on arbitrary programs is a security problem (since you could be
giving any user the ability to do random things as another user,
possibly root).
Thanks for the response everyone. All doubts cleared now. :)
--
Chris Adams <cmadams(a)hiwaay.net>
--
Suvayu
Open source is the future. It sets us free.