* Help: Set-user-ID
@ 1995-03-07 15:17 Robert Blake
1995-03-08 16:02 ` Mike Simons
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Robert Blake @ 1995-03-07 15:17 UTC (permalink / raw)
I've been trying to write a shell script that other users can run and appear
to be me for the duration of the command. I'm using Alpha OSF/1 v1.3.
I've written a very simple shell script called fred:
#!/bin/sh
echo Hi!!
whoami
rm /usr/user1/temp/test~
test~ is a file that only user1 has write permission to. Having written this as
user1, I then 'chmod 4655 fred' so the permissions look thus:
-rwSr-xr-x 1 user1 physics 117 Mar 07 14:53 fred
I then log in as user2 and try to run it. The output is:
Hi!!
user2
rm: override protection 700 for /usr/user1/temp/test~? y
rm: /usr/user1/temp/test~ not removed. Permission denied
Anyone any idea what I'm doing wrong?
---------------------------------------------------------------------------
_/_/_/_/_/
_/ _/ _/ Rob Blake (R.P.Blake@open.ac.uk)
_/ _/ _/ [Overworked PhD student (Danger! Irony chip overload)]
_/_/_/_/_/
_/_/ _/ Quote of the week : "An optimist believes that this is
_/ _/ _/ the best of all possible worlds. A pessimist fears
_/ _/_/_/ that this is true."
---------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help: Set-user-ID
1995-03-07 15:17 Help: Set-user-ID Robert Blake
@ 1995-03-08 16:02 ` Mike Simons
1995-03-08 22:33 ` Walter Karig
1995-03-09 3:37 ` Spider Boardman
2 siblings, 0 replies; 4+ messages in thread
From: Mike Simons @ 1995-03-08 16:02 UTC (permalink / raw)
Robert Blake (rpblake@ASSP01.open.ac.uk) wrote:
: I've been trying to write a shell script that other users can run and appear
: to be me for the duration of the command. I'm using Alpha OSF/1 v1.3.
: I've written a very simple shell script called fred:
: #!/bin/sh
: echo Hi!!
: whoami
: rm /usr/user1/temp/test~
: test~ is a file that only user1 has write permission to. Having written this as
: user1, I then 'chmod 4655 fred' so the permissions look thus:
: -rwSr-xr-x 1 user1 physics 117 Mar 07 14:53 fred
: Anyone any idea what I'm doing wrong?
Well... If I understand things correctly OSF ignores the set UID and
GID bits for script files of any type. Basically if binary file then it
checks the UID and GID bits... and sets the appropriate permissions on the
process otherwise it runs with the permissions of the user who invoked the
script.
Apparently SID and GID script files have been and are a real big
security whole on Unix systems... so OSF decided to do away with the
whole problem.
What I would recommend (and what I was told) is to write a short
c-program to do whatever you were going to do, compile it, and then
set UID on that.
Hope that helps,
Mike Simons
msimons@csugrad.cs.vt.edu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help: Set-user-ID
1995-03-07 15:17 Help: Set-user-ID Robert Blake
1995-03-08 16:02 ` Mike Simons
@ 1995-03-08 22:33 ` Walter Karig
1995-03-09 3:37 ` Spider Boardman
2 siblings, 0 replies; 4+ messages in thread
From: Walter Karig @ 1995-03-08 22:33 UTC (permalink / raw)
In article <RPBLAKE.95Mar7081755@ASSP01.open.ac.uk>, rpblake@ASSP01.open.ac.uk
(Robert Blake) writes:
|>
|>I've been trying to write a shell script that other users can run and appear
|>to be me for the duration of the command. I'm using Alpha OSF/1 v1.3.
|>
|> I've written a very simple shell script called fred:
|>
|> #!/bin/sh
|> echo Hi!!
|> whoami
|> rm /usr/user1/temp/test~
|>
|>test~ is a file that only user1 has write permission to. Having written this
|>as
|>user1, I then 'chmod 4655 fred' so the permissions look thus:
|>
|> -rwSr-xr-x 1 user1 physics 117 Mar 07 14:53 fred
|>
|> I then log in as user2 and try to run it. The output is:
|>
|> Hi!!
|> user2
|> rm: override protection 700 for /usr/user1/temp/test~? y
|> rm: /usr/user1/temp/test~ not removed. Permission denied
|>
|>Anyone any idea what I'm doing wrong?
Write a C source fred.c as user1:
main()
{
system("rm /usr/user1/temp/test~");
}
Compile and change mode:
$ cc fred.c -o fred
$ chmod +s fred
Then you can run it as user2.
Walter
--
+-----------------------------------------------------------------------------+
| Walter Karig | Gesellschaft fuer Schwerionenforschung |
| Phone: 0049-6151-359-2147 | Planckstrasse 1 |
| E-Mail: W.Karig@gsi.de | D-64291 Darmstadt |
+-----------------------------------------------------------------------------+
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help: Set-user-ID
1995-03-07 15:17 Help: Set-user-ID Robert Blake
1995-03-08 16:02 ` Mike Simons
1995-03-08 22:33 ` Walter Karig
@ 1995-03-09 3:37 ` Spider Boardman
2 siblings, 0 replies; 4+ messages in thread
From: Spider Boardman @ 1995-03-09 3:37 UTC (permalink / raw)
In article <RPBLAKE.95Mar7081755@ASSP01.open.ac.uk> rpblake@ASSP01.open.ac.uk (Robert Blake) writes:
Rob> Anyone any idea what I'm doing wrong?
Yes. You're trying to use a setuid shell script. DEC OSF/1
closed the inherent security hole with them by refusing to honour
setuid bits on scripts.
If you really need something like this to work, you need to use a
wrapper program to do the job. However, most wrapper setups for
this just re-introduce the original problem, so be careful.
There are pointers to additional information on wrappers for
scripts in the comp.lang.perl meta-FAQ (indirectly, anyway, via
the full FAQ).
--
Spider Boardman (at home) spider@Orb.Nashua.NH.US
The management (my cats) made me say this ...!decvax!orb!spider
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1995-03-09 3:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-03-07 15:17 Help: Set-user-ID Robert Blake
1995-03-08 16:02 ` Mike Simons
1995-03-08 22:33 ` Walter Karig
1995-03-09 3:37 ` Spider Boardman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox