Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Nov 2000 22:39:40 -0600
From:      Dan Nelson <dnelson@emsphone.com>
To:        Lu!s Croker <lcroker@megared.net.mx>
Cc:        George Reid <greid@dogma.freebsd-uk.eu.org>, freebsd-questions@FreeBSD.ORG
Subject:   Re: SETUID !
Message-ID:  <20001113223940.A18464@dan.emsphone.com>
In-Reply-To: <20001113185137.47d046ef.lcroker@megared.net.mx>; from "Lu!s Croker" on Mon Nov 13 18:51:37 GMT 2000
References:  <20001113182224.161b51e3.lcroker@megared.net.mx> <Pine.BSF.4.21.0011140027560.94722-100000@sobek.nevernet.net> <20001113185137.47d046ef.lcroker@megared.net.mx>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001113223940.A18464>