From owner-freebsd-questions Sun Dec 1 10: 8:34 2002 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 3AB1037B401 for ; Sun, 1 Dec 2002 10:08:33 -0800 (PST) Received: from catv-50622a7a.nyircatv.broadband.hu (catv-50622a7a.nyircatv.broadband.hu [80.98.42.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A29D43E4A for ; Sun, 1 Dec 2002 10:08:17 -0800 (PST) (envelope-from andrew@kronos.HomeUnix.com) Received: from slave.east.ath.cx (witch@slave.east.ath.cx [10.1.1.1]) by catv-50622a7a.nyircatv.broadband.hu (8.12.6/8.12.6) with ESMTP id gB1I87Sq001246 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sun, 1 Dec 2002 19:08:08 +0100 (CET) (envelope-from andrew@kronos.HomeUnix.com) Date: Sun, 1 Dec 2002 19:08:07 +0100 (CET) From: Andrew Prewett Reply-To: Andrew Prewett To: Kirk Bailey Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Run as owner In-Reply-To: <3DE991FC.20200@netzero.net> Message-ID: <20021201183412.I50396-100000@slave.east.ath.cx> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Nov 30 Kirk Bailey wrote: > This script is not perl, it is in python. So far the python community has > failed in the search for clue, possibly this one can assist? > Python or not python is irrevelant here. As last resort, if you don't want to use su, sudo or ksu, you can use a setuid/setgid wrapper program to execute your script: ---- wrapper.c ----- #include #include int main(void) { execlp("/full/path/to/script", "script", "arg1", "arg2", NULL); perror("script"); return 1; } ------------------- arg1/arg2 is the first/second argument to the script, if any. ie: "-c" "filename". If there is no args, then leave them out. ---- Makefile ----- PROG= wrapper NOMAN= yep .include ------------------- - put the wrapper.c and the Makefile in a dir, and issue the make command. - change the owner (group), ie.: chown joeuser:joegroup wrapper - turn the setuid bit on: chmod 04555 wrapper (not the script) Hope this helps, -andrew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message