[Tfug] Scripting Question

John Gruenenfelder johng at as.arizona.edu
Sat Apr 18 02:39:48 MST 2009


On Sat, Apr 18, 2009 at 03:52:45AM -0400, Charles R. Kiss wrote:
> If I'm a superlazy user and want a keyboard shortcut to run a pair of  
> scripts that contain commands that require the superuser's priveleges,  
> what's a safe way to do that?  For example, a script that is only  
> executable, not readable or writeable, and contains commands such as 
> mount but is able to run via a user who is not root.  Or is this a super  
> horrible idea for some reason?
>
> I don't want to have to login in as superuser, I don't want to have to  
> enter a password, or sudo, etc.
>
> I just want to press a button to unlock/lock a set of files and  
> directories by umounting and chmoding them after backing them up; so the  
> unlocking script wil contain mount, chmod, etc. and the locking script  
> will contain cp, chmod ,umount, etc.
>
> Thanks,
> charles

I don't know that this will work, can't remember trying it in the past myself,
but can you make the script suid root?  Stick it in, say, /usr/local/sbin,
make it owned by root, and then "chmod a+s" the script.  Works for regular
binaries, of course, maybe for scripts, too?


-- 
--John Gruenenfelder    Systems Manager, MKS Imaging Technology, LLC.
Try Weasel Reader for PalmOS  --  http://weaselreader.org
"This is the most fun I've had without being drenched in the blood
of my enemies!"
        --Sam of Sam & Max




More information about the tfug mailing list