Sudoers list?

Matt Palmer mpalmer at hezmatt.org
Wed Apr 5 07:29:49 UTC 2006


On Wed, Apr 05, 2006 at 09:25:43AM +1000, Peter Garrett wrote:
> On Wed, 5 Apr 2006 07:43:59 +1000
> Matthew Palmer <mpalmer at hezmatt.org> wrote:
> 
> > > I don't want to force people to run this script as root. Running stuff 
> > > as root is a really bad habit. I want this script to be as non-root 
> > > friendly as possible. There is only one step that *might* warrant root 
> > > access and that's if the destination directory belongs to root.
> > 
> > How is it better for a script to say "hey, can you give me root privs now"
> > before doing something nasty, as opposed to saying "you have to give me root
> > privileges at the beginning" before doing something nasty?
> 
> Because there are two use cases:
> 
> 1. The installation is made to a directory not requiring root privileges
> ( $HOME for instance )
> 
> 2. The installation is system-wide and is going to be in, say, /usr
> 
> If (1), then the script does not require root privileges
> If (2), then it only requires root privileges for the actual writing /
> installation to the relevant directory.
> 
> Hence, why ask for root privileges if the user is only installing to his
> $HOME directory?

if [ ! -w "$INSTDIR" ]; then
        cat <<EOF
You do not have permission to install this program into the destination you
have chosen.  Please select a different location or run this script again
using sudo.
EOF
        exit 1
fi

- Matt

-- 
"I'm tempted to try Gentoo, but then I learned that its installer is in
Python, and, well, a base Python install on my system is something like
fifty megabytes (for what?  oh, right, we NEED four XML libraries, I
forgot)."  -- Dave Brown, ASR




More information about the ubuntu-users mailing list