From owner-freebsd-questions@FreeBSD.ORG Tue Jul 22 12:37:35 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 B174237B401 for ; Tue, 22 Jul 2003 12:37:35 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0EA1A43FBD for ; Tue, 22 Jul 2003 12:37:35 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h6MJbTd5052598; Tue, 22 Jul 2003 14:37:29 -0500 (CDT) (envelope-from dan) Date: Tue, 22 Jul 2003 14:37:29 -0500 From: Dan Nelson To: Ryan Thompson Message-ID: <20030722193729.GH94261@dan.emsphone.com> References: <20030722123627.A21583-100000@ren.sasknow.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030722123627.A21583-100000@ren.sasknow.com> X-OS: FreeBSD 5.1-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i cc: "Gerald S. Stoller" cc: FreeBSD Questions cc: vze25pmf@verizon.net 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 19:37:36 -0000 In the last episode (Jul 22), Ryan Thompson said: > If you *really* want to have suid scripts, your binary wrapper idea is > quite a common trick. Don't get fancy with it, though. A one-liner to > execve(2) should really be all you need. Either that, or re-code the > whole thing in C (or some other compiled language). C can introduce > insecurities of its own, but at least you'd (arguably) have put them > there yourself. :-) I use sudo for stuff like this. I add a line like this in sudoers: ALL ALL = NOPASSWD: /usr/local/bin/thescript and put this it the top of thescript: #! /bin/sh if [ $(id -u) -ne 0 ] ; then if [ "$TRYINGSUDO" = "1" ] ; then echo "Cannot get admin priviledges! Exiting" exit 1 else export TRYINGSUDO=1 exec sudo $0 "$@" fi fi -- Dan Nelson dnelson@allantgroup.com