Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: karig@dslep01.gsi.de (Walter Karig)
Subject: Re: Help: Set-user-ID
Date: 8 Mar 1995 22:33:15 GMT	[thread overview]
Message-ID: <3jlbbb$8st@rs18.hrz.th-darmstadt.de> (raw)
In-Reply-To: RPBLAKE.95Mar7081755@ASSP01.open.ac.uk


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                      |
+-----------------------------------------------------------------------------+


  parent reply	other threads:[~1995-03-08 22:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
1995-03-09  3:37 ` Spider Boardman
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox