Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Aug 2009 04:27:03 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Tim Judd <tajudd@gmail.com>
Cc:        RW <rwmaillists@googlemail.com>, freebsd-questions@freebsd.org
Subject:   Re: SUID permission on Bash script
Message-ID:  <20090829042703.ed4553a3.freebsd@edvax.de>
In-Reply-To: <ade45ae90908281910o2de3c2c8ra5cde55a9ecead45@mail.gmail.com>
References:  <beaf3aa50908280124pbd2c760v8d51eb4ae965dedc@mail.gmail.com> <87y6p4pbd0.fsf@kobe.laptop> <20090829022431.5841d4de@gumby.homeunix.com> <ade45ae90908281910o2de3c2c8ra5cde55a9ecead45@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 28 Aug 2009 20:10:59 -0600, Tim Judd <tajudd@gmail.com> wrote:
> Dunno, but this dawns on me..
> 
> what defines a script?  I've always defined a script that starts with
> a #! shebang.
> 
> So the script can be SUID, but the interpreter/shell isn't.  Is that
> why it doesn't work?

What is the difference of the script and the interpreter? The
script is read and executed by the shell, the script itself isn't
runnable at all.

The itnerpreter specified by #! is executed and then starts to
process the script. Is the interpreter running at SUID? Are the
commands (child processes) that it executes (fork) running at
SUID?

But let us continue this consideration:

If the shell process would be replaced by the command that is
called, would it make a difference? Compare

	#!/bin/sh		<- this starts /bin/sh
	shutdown -p now		<- /bin/sh starts child shutdown

to

	#!/bin/sh		<- this starts /bin/sh
	exec shutdown -p now	<- /bin/sh replaced by shutdown

Hmmm... do I see this correctly?



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090829042703.ed4553a3.freebsd>