From owner-freebsd-questions@FreeBSD.ORG Mon Jul 21 21:31:45 2003 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 9759E37B401 for ; Mon, 21 Jul 2003 21:31:45 -0700 (PDT) Received: from ren.sasknow.com (ren.sasknow.com [207.195.92.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id D05B143F93 for ; Mon, 21 Jul 2003 21:31:44 -0700 (PDT) (envelope-from ryan@sasknow.com) Received: from ren (ren [207.195.92.131]) by ren.sasknow.com (8.12.6p2/8.12.6) with ESMTP id h6M4ViD7023158; Mon, 21 Jul 2003 22:31:44 -0600 (CST) (envelope-from ryan@sasknow.com) Date: Mon, 21 Jul 2003 22:31:44 -0600 (CST) From: Ryan Thompson To: "Gerald S. Stoller" In-Reply-To: Message-ID: <20030721222719.Q31748-100000@ren.sasknow.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-questions@freebsd.org Subject: Re: set user-id X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2003 04:31:45 -0000 Gerald S. Stoller wrote to freebsd-questions@freebsd.org: > FreeBSD 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Sat Apr 21 10:54:49 GMT > 2001 jkh@narf.osd.bsdi.com:/usr/src/sys/compile/GENERIC i386 > > As root, I made a text file (named t ) that did > something like > echo $USER | tee xx Please give complete examples. As posted, your example wouldn't run without invoking sh(1) first. I'm assuming it was something like: #!/bin/sh echo $USER | tee xx > and then had it set user-id (I did 'chmod 4755 t'). As a plain > user, I made a directory that only root can write my current > directory and then invoked t (by giving a path-name to it). It > reported that the USER was the plain user and couldn't write into > the directory. It appears that the set user-id didn't work, but I > also checked t with ls -l and the permissions were rwsr-xr-x , > exactly like that of passwd and xterm (except maybe for the write > permission of the owner). > How do I get set user-id to work? Your permissions are fine, but you're hitting a more subtle problem: S*id bits don't work for interpreted scripts (denoted by the shebang, #!), by design. If you'd compiled the equivalent example to a binary, I'd expect it to work as you intended. - Ryan -- Ryan Thompson SaskNow Technologies - http://www.sasknow.com 901-1st Avenue North - Saskatoon, SK - S7K 1Y4 Tel: 306-664-3600 Fax: 306-244-7037 Saskatoon Toll-Free: 877-727-5669 (877-SASKNOW) North America