I am using rubygems (1.3.7) with gems that require root privileges on Ubuntu 10.10. When I compare my setup to an ubuntu 9.10 with rubygems 1.3.6 installation, I see the following difference in
1.3.7 / 10.10
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
1.3.6 / 09.10
- EXECUTABLE DIRECTORY: /usr/bin
The output is the same whether I use
sudo or not. To fix this (I don't know why it is different in the first place), I tried to modify my path variable.
My question is, where does
sudo look for executables? If I install a gem (using
sudo) the executable is placed in the
/var path obviously. I added this path to my
/etc/environment files, but I cannot get
sudo to execute the executables.
If I run:
$ gemnameit runs my tool correctly.
$ sudo gemnameit merely tells me
command not found.
$ sudo echo $PATHit does show the correct path.
$ sudo -i gemnameit runs correctly.
$ sudo sudo -Vshows that the PATH is preserved.
/etc/environment? If so, they why can't it find my executable while the directory is shown in the
$PATH environment variable?
I have read the documentation of
sudo, I also search and looked through a ton of topics on stackoverflow and serverfault (for instance How to override a PATH environment variable in sudo?, but my example shows that
$PATH contains the correct path), but they never actually show how to run a gem via