From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: David Presotto To: dvd@davidashen.net, 9fans@cse.psu.edu Subject: Re: [9fans] Novice question - run as other MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-yqhuppmcyevqwhceqskcdbbgeb" Date: Wed, 17 Mar 2004 07:43:53 -0500 Topicbox-Message-UUID: 33865098-eacd-11e9-9e20-41e7f4b1d025 This is a multi-part message in MIME format. --upas-yqhuppmcyevqwhceqskcdbbgeb Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit It worked, I believe you just didn't notice. The echo process became none and then immediately died. --upas-yqhuppmcyevqwhceqskcdbbgeb Content-Type: message/rfc822 Content-Disposition: inline Received: from plan9.cs.bell-labs.com ([135.104.9.2]) by plan9; Wed Mar 17 03:57:30 EST 2004 Received: from mail.cse.psu.edu ([130.203.4.6]) by plan9; Wed Mar 17 03:57:27 EST 2004 Received: by mail.cse.psu.edu (CSE Mail Server, from userid 60001) id 3FE5019CC6; Wed, 17 Mar 2004 03:57:25 -0500 (EST) Received: from psuvax1.cse.psu.edu (psuvax1.cse.psu.edu [130.203.4.6]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 36BCC19DAF; Wed, 17 Mar 2004 03:57:20 -0500 (EST) X-Original-To: 9fans@cse.psu.edu Delivered-To: 9fans@cse.psu.edu Received: by mail.cse.psu.edu (CSE Mail Server, from userid 60001) id D18DB19DAF; Wed, 17 Mar 2004 03:56:59 -0500 (EST) Received: from adat.davidashen.net (unknown [217.113.20.242]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 2053219DAC for <9fans@cse.psu.edu>; Wed, 17 Mar 2004 03:56:53 -0500 (EST) Received: from adat.davidashen.net (localhost.davidashen.net [127.0.0.1]) by adat.davidashen.net (8.12.8p1/8.12.8) with ESMTP id i2H8sq7b083769 for <9fans@cse.psu.edu>; Wed, 17 Mar 2004 12:54:52 +0400 (AMT) (envelope-from dvd@adat.davidashen.net) Received: (from dvd@localhost) by adat.davidashen.net (8.12.8p1/8.12.8/Submit) id i2H8sk2J083766 for 9fans@cse.psu.edu; Wed, 17 Mar 2004 12:54:46 +0400 (AMT) From: David Tolpin Message-Id: <200403170854.i2H8sk2J083766@adat.davidashen.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] Novice question - run as other In-Reply-To: Sender: 9fans-admin@cse.psu.edu Errors-To: 9fans-admin@cse.psu.edu X-BeenThere: 9fans@cse.psu.edu X-Mailman-Version: 2.0.11 Precedence: bulk Reply-To: 9fans@cse.psu.edu List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.cse.psu.edu> List-Archive: Date: Wed, 17 Mar 2004 12:54:46 +0400 (AMT) X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on psuvax1.cse.psu.edu X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.63 X-Spam-Level: > >> > a program from a shell script and change the user it runs as. > >> > >> The security model doesn't allow this. Perhaps by running it as a service > >> on a cpu. Check /sys/src/cmd/auth/cron.c and cap(3). For somethings > >> you can cpu over and change to a different uid: > > > > The following works: > ... > > fd>=0 && (write(fd,"none",strlen("none"))!=-1) > > That's not what you asked. > ? Is none not user? cpu% grep none /adm/users 0:none:adm cpu% none cat /env/user none I want a program to run as a different user. From C, it means opening '#c/user' and writing the user's name there. The security model is a separate issue, the call either succeeds or fails, but it is a consequence of security limitations, and not of the API. My question was how to do the same from rc. @{echo -n none > '#c/user' ; while() {sleep 1} } succeeds but does not change the owner of the process. Why? Dav id --upas-yqhuppmcyevqwhceqskcdbbgeb--