From owner-freebsd-questions Mon Nov 13 20:41: 4 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id DB6B637B479 for ; Mon, 13 Nov 2000 20:41:00 -0800 (PST) Received: (from dan@localhost) by dan.emsphone.com (8.11.1/8.11.1) id eAE4dep24258; Mon, 13 Nov 2000 22:39:40 -0600 (CST) (envelope-from dan) Date: Mon, 13 Nov 2000 22:39:40 -0600 From: Dan Nelson To: Lu!s Croker Cc: George Reid , freebsd-questions@FreeBSD.ORG Subject: Re: SETUID ! Message-ID: <20001113223940.A18464@dan.emsphone.com> References: <20001113182224.161b51e3.lcroker@megared.net.mx> <20001113185137.47d046ef.lcroker@megared.net.mx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.11i In-Reply-To: <20001113185137.47d046ef.lcroker@megared.net.mx>; from "Lu!s Croker" on Mon Nov 13 18:51:37 GMT 2000 X-OS: FreeBSD 5.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Nov 13), Lu!s Croker said: > Hi.. I know SUDO, but I don't want use it for this process... I need > something like Setuid.. but this is not working... what's worng ?? Why don't you want to use sudo? Here's what I do in one of my backup scripts that need to run setuid: if [ `id -u` != 0 ] ; then if [ $TRYINGSUDO = 1 ] ; then echo "Cannot get admin priviledges! All files may not get backed up" else TRYINGSUDO=1 export TRYINGSUDO exec sudo $0 "$@" fi fi I have sudo configured to not prompt for a password. When a regular user executes the script, it immediately re-executes itself via sudo. The user doesn't need to know about sudo at all. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message