[sudo-users] path discrepancy

Tim Saylor tim.saylor at gmail.com
Mon Oct 15 12:29:41 EDT 2007


I have a script named "vhost" in /usr/local/scripts owned by my user,
tsaylor.  I added that directory to my PATH and I could run it fine as
tsaylor but not with sudo.  When I changed its ownership to root, tsaylor
didn't have permission to run it but still found it and sudo still couldn't
find it.  When I run "which vhost" as tsaylor and as root through "sudo -s",
both can find the script, but "sudo which vhost" can't find it.  Anyone know
what the problem is?  Where does sudo get it's search path?  I believe this
is a standard install of ubuntu feisty server, using sudo version 1.6.8p12.
Below is an example of the problem.  Thanks!


tsaylor at ubuntu:/usr/local/scripts$ ll
total 4
-rwxr--r-- 1 root root 2533 2007-10-13 03:38 vhost
tsaylor at ubuntu:/usr/local/scripts$ sudo chown tsaylor:tsaylor vhost
tsaylor at ubuntu:/usr/local/scripts$ cd
tsaylor at ubuntu:~$ vhost
Usage: vhost -u <URL> -e <EMAIL>

Options:
  -h, --help            show this help message and exit
  -u example.com, --url= example.com
                        The URL of the vhost. (Required)
  -e you at example.com, --email= you at example.com
                        The administrator email for the vhost. (Required)
ERROR: vhost file (/etc/apache2/sites-available/example.com) already exists.
tsaylor at ubuntu:~$ sudo vhost
sudo: vhost: command not found
tsaylor at ubuntu:~$ cd -
/usr/local/scripts
tsaylor at ubuntu :/usr/local/scripts$ sudo chown root:root vhost
tsaylor at ubuntu:/usr/local/scripts$ ll
total 4
-rwxr--r-- 1 root root 2533 2007-10-13 03:38 vhost
tsaylor at ubuntu:/usr/local/scripts$ cd -
/home/tsaylor
tsaylor at ubuntu:~$ vhost
-bash: /usr/local/scripts/vhost: Permission denied
tsaylor at ubuntu:~$ sudo vhost
sudo: vhost: command not found



More information about the sudo-users mailing list