From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,a1fe009cb39103d4 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1995-03-09 19:00:22 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!xlink.net!wega.fibronics.de!odb!news.th-darmstadt.de!dslep01.gsi.de!karig From: karig@dslep01.gsi.de (Walter Karig) Newsgroups: comp.unix.osf.osf1 Subject: Re: Help: Set-user-ID Date: 8 Mar 1995 22:33:15 GMT Organization: GSI Darmstadt, Germany Sender: karig@dslep01 (Walter Karig) Distribution: world Message-ID: <3jlbbb$8st@rs18.hrz.th-darmstadt.de> References: Reply-To: karig@dslep01.gsi.de (Walter Karig) NNTP-Posting-Host: dslep01.gsi.de In article , 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 | +-----------------------------------------------------------------------------+