1

when I want to start svn with sudo, I get this error message

sudo: svn: command not found

I recently compiled the newest subversion on my own and removed the subversion from my RedHat 7 machine. When I log as a user on my system and type svn, I get Type 'svn help' for usage., which indicates, that is could find svn.

According to https://serverfault.com/a/505972/297310 I started to investigate where the problem might be.

First, I checked my $PATH variable

echo $PATH
> /usr/local/cuda-6.5/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/gradle/latest/bin:/root/bin
sudo echo $PATH
> /usr/local/cuda-6.5/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/gradle/latest/bin:/root/bin

No difference in output, when call these commands as user or root.

whereis svn
> svn: /usr/local/bin/svn
sudo whereis svn
> svn: /usr/local/bin/svn

The same as with $PATH. This is somehow odd. When I type these commands, this does not help

svn
> Type 'svn help' for usage.
sudo svn
> sudo: svn: command not found

Can anyone give me some hints, how to find the solution. I do not want to install the subversion package again, because I want to use the latest subversion and the package version is to old for my purposes.

devopsfun
  • 1,407
  • 1
    sudo does not preserve your environment for security reasons, especially not $PATH. If you are allowed to, you may try sudo -E svn (see man sudo). For the default $PATH and default kept environments see sudo -l. – ridgy Jan 31 '17 at 13:13
  • 1
    If you issue sudo echo $PATHthen $PATH will be resolved by the calling shell, not the sudoshell. And whereisdoes not only look in $PATH and $MANPATH, but also in some hardcoded places (try whereis -l to see the whole tree). If instead you use whichcommand, you will see the difference. Or sudo su and the echo $PATH. – ridgy Jan 31 '17 at 14:49

0 Answers0