Re: SUID on Solaris versus Linux

From: Matthew Zito <matt_at_crackpotideas.com>
Date: Tue, 27 Nov 2012 16:15:49 -0500
Message-ID: <CAJ7936wm0UdvDXEyQNu-Z_54Yr1Ai7T-Hq5fDn_GSZ7dTve3Zw_at_mail.gmail.com>



Ah-ha - you've hit a fun quirk of Linux. Linux does not support the setuid bit on anything with a magic number that references an external executable, i.e. that starts with #!.
http://unix.stackexchange.com/questions/364/allow-setuid-on-shell-scripts

That stackexchange article has a really good summary of the issue, and some ideas for working around it.

Also, I'm pretty sure that newer versions of Solaris behave similarly, so perhaps it's best to take this approach for both OSes going forward and insure forward compatibility.

Thanks,
Matt

On Tue, Nov 27, 2012 at 4:03 PM, Hameed, Amir <Amir.Hameed_at_xerox.com> wrote:

> Folks,
> I am trying to understand why the SUID is behaving differently on Solaris
> versus Linux. It is working fine on Solaris and not working on Linux.
> I have a test script that I am running on both Solaris and Linux. The
> storage is NAS based and "suid" is set in the mount command. Here are the
> contents of the script:
> -----------
> cat /tmp/t1
> #!/bin/sh
> touch /home/oracle/1
> -----------
>
> $ ls -ltr /tmp/t1
> -rwsr-xr-x 1 oracle oinstall 31 Nov 27 13:39 /tmp/t1
>
>
> Any idea why SUID is not working on Linux the way it is on Solaris.
>
> Thanks
> Amir
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Nov 27 2012 - 22:15:49 CET

Original text of this message