From owner-freebsd-questions Sat Apr 7 3:27:30 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-26-235-186.mmcable.com [65.26.235.186]) by hub.freebsd.org (Postfix) with SMTP id 6FFDA37B42C for ; Sat, 7 Apr 2001 03:27:28 -0700 (PDT) (envelope-from mwm@mired.org) Received: (qmail 62210 invoked by uid 100); 7 Apr 2001 10:27:24 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15054.60300.671173.605392@guru.mired.org> Date: Sat, 7 Apr 2001 05:27:24 -0500 To: "Mick Gallagher" Cc: questions@freebsd.org Subject: Re: set-user-id question In-Reply-To: <9164700@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mick Gallagher types: > Hi All, > > Say I have a shell script, called egscript, say, and the content of the > script is 'touch testfile'. > > Now if I run the script (all the execute permissions are set), then lo and > behold, I find the file 'testfile' in the local directory. > > If I set the suid permissions, and someone else runs the file, no 'testfile' > appears. > > Why is this the case? Does suid only work on binaries? What prevents others > from running this script with my permissions? The code sure looks like it doesn't. Some systems do, and it's a horrible security risk. It's to easy to convince the interpreter on a setuid script to run your command instead of the commands in the script. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message