From owner-freebsd-questions Mon May 8 8:14:53 2000 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id CC7FE37B65B for ; Mon, 8 May 2000 08:14:47 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from strontium.scientia.demon.co.uk ([192.168.91.36] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.12 #1) id 12opDT-000MgZ-00; Mon, 08 May 2000 16:13:03 +0100 Received: (from ben) by strontium.scientia.demon.co.uk (Exim 3.12 #7) id 12opDT-000Klq-00; Mon, 08 May 2000 16:13:03 +0100 Date: Mon, 8 May 2000 16:13:02 +0100 From: Ben Smithurst To: Arun Sharma Cc: FreeBSD Questions Subject: Re: setuid for interpreted languages ? Message-ID: <20000508161302.F79359@strontium.scientia.demon.co.uk> References: <20000507230115.A61438@sharmas.dhs.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20000507230115.A61438@sharmas.dhs.org> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Arun Sharma wrote: > How do I make a python script, a setuid program in FreeBSD ? I have a > py-kde based python script that needs to be setuid to read the temperature > sensors on my ABit BP6. > > # chmod 4755 khm.py > > doesn't seem to do it. Well, perl has "suidperl", maybe Python has something similar. Otherwise you could make a small setuid wrapper around your script. It only needs to be as simple as: #include extern char **environ; int main(int argc, char *argv[]) { argv[0] = "/path/to/khm.py"; execve(argv[0], argv, environ); return (1); /* shouldn't get here */ } Just compile that, make it setuid (root, presumably) and it should work. I'll assume you already know the potential dangers of setuid programs. -- Ben Smithurst / ben@scientia.demon.co.uk / PGP: 0x99392F7D To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message