[olug] chmod u+s

m0ntar3 at cox.net m0ntar3 at cox.net
Fri Jun 4 16:00:03 UTC 2004


Setting the User-Identification-Bit on a log file doesn't give you 
anything, it's actually pretty meaningless. Setting UID on the "cat" 
executable with "root" ownership and allowing it to be executed by 
"other" would give you more than you want.

Setting UID makes "the process" run as the user that owns the file from 
which the process is mapped. Log files don't map to processes, log files 
are read by processes.

The "cat" process, in this case, executes with the user permission 
delivered by the interactive shell that launched the "cat" process. The 
"cat" process, correctly, does not inherit the UID of the log file it reads.

The other question; should an interpreter process (sh, bash, awk, perl, 
etcetera) inherit the UID of the interpreted file or keep the UID of the 
binary that reads the interpreted file is largely philosophical---kind 
of a liberty verses freedom thing ;)

Jay Hannah wrote:

>
> Huh? What good is the setUID bit if it doesn't let me do this?
>
> Setup:
> root at chinstrap log # ls -al mail.log.cat
> -rwsr-xr-x    1 root     root           22 Jun  3 17:03 mail.log.cat
> root at chinstrap log # cat mail.log.cat
> cat /var/log/mail.log
>
> Try to use it:
> jhannah at chinstrap log $ ./mail.log.cat
> cat: /var/log/mail.log: Permission denied
>
> Gentoo, Linux 2.6.6
>
> j
>
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
>


More information about the OLUG mailing list