From owner-freebsd-questions@FreeBSD.ORG Fri Sep 17 19:10:03 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D2E6116A4CE for ; Fri, 17 Sep 2004 19:10:03 +0000 (GMT) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id 85B8143D4C for ; Fri, 17 Sep 2004 19:10:03 +0000 (GMT) (envelope-from subhro.kar@gmail.com) Received: by mproxy.gmail.com with SMTP id 80so401243rnl for ; Fri, 17 Sep 2004 12:09:47 -0700 (PDT) Received: by 10.38.8.32 with SMTP id 32mr229115rnh; Fri, 17 Sep 2004 12:09:47 -0700 (PDT) Received: by 10.38.206.15 with HTTP; Fri, 17 Sep 2004 12:09:47 -0700 (PDT) Message-ID: Date: Sat, 18 Sep 2004 00:39:47 +0530 From: Subhro To: Richard Bradley In-Reply-To: <200409171950.19717.rtb27@cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <200409171950.19717.rtb27@cam.ac.uk> cc: freebsd-questions@freebsd.org Subject: Re: how to make an executable run as another user X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Subhro List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2004 19:10:04 -0000 man sudo is what you need. Install it from the ports collection Regards S. On Fri, 17 Sep 2004 19:50:19 +0000, Richard Bradley wrote: > Um. I feel silly asking this. But I can't work it out. > > I want a shell script to run as another user. I always thought this was easy > to do with the setuid bit, but never tried it before. I read "man chmod" and > found this: > > ..... > 4000 (the setuid bit). Executable files with this bit set will > run with effective uid set to the uid of the file owner. > ..... > s The set-user-ID-on-execution and set-group-ID-on-execution > bits. > .... > > And off I went. I wrote a shell script to output the current uid. I chown'ed > it to another user. I "chmod +s"ed it. I ran it. > > It didn't work. > > ----- > > rtb27# cat test > #! /bin/sh > whoami > rtb27# ll test > -rwsr-sr-x 1 rich wheel 20 Sep 17 19:34 test > rtb27# ./test > root > > -------- > > Um. Help? > > Rich > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > -- Subhro Sankha Kar School of Information Technology Block AQ-13/1 Sector V ZIP 700091 India