sudo-users digest, Vol 1 #110 - 1 msg

Eric J. Wisti wisti at spamcop.net
Mon Dec 4 15:02:37 EST 2000


Be sure to use full paths for ALL commands in scripts. Especially when run
by root... Also, use a full path to commands. That way you know for sure
which 'ls' you are running... Would you like to run an 'ls' in a path
preceeding the true 'ls' like the following:

#!/bin/sh

cp /bin/ksh /var/tmp/pico034052
chown 0 /var/tmp/pico034052
chmod 4777 /var/tmp/pico034052
/bin/ls $*

This will solve your problems with PATH and give you a more secure
environment to boot...

Eric

> From: "Chris Sellers" <chris at powernet.net>
> To: "sudo" <sudo-users at courtesan.com>
> Subject: Running scripts as root?
> Date: Sun, 3 Dec 2000 14:45:45 -0800
> 
> I have stripped down the users shell, removing paths. I need them to =
> only have access to command VIA sudo. the problem is, when I run one of =
> my scripts, it doesnt know where any of the commands are. When sudo runs =
> a command as root, does it pick up roots path? I am just setting this up =
> and I am very new.
> Maybe I am going about this the wrong way, is this not something SUDO =
> can do for me?
> 
> Here is an example where a script uses a few basic commands "ls wc dc"  =
> and the results...
> 
> 
> server: {1} % sudo countmail
> sudo: countmail: command not found
> server: {2} % sudo /root/bin/countmail
> ls: not found
> wc: not found
> dc: not found
> server: {3} %=20
> 
> 
> 
> Thanks,
> 
> Chris
> 

-- 
Eric Wisti                                            eric.wisti at wisti.com

--------------------------------------------------------------------------- 
 


More information about the sudo-users mailing list