Date: Sun, 1 Dec 2002 19:08:07 +0100 (CET) From: Andrew Prewett <andrew@kronos.HomeUnix.com> To: Kirk Bailey <idiot1@netzero.net> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Run as owner Message-ID: <20021201183412.I50396-100000@slave.east.ath.cx> In-Reply-To: <3DE991FC.20200@netzero.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <unistd.h> #include <stdio.h> 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 <bsd.prog.mk> ------------------- - 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021201183412.I50396-100000>