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.
sudodoes not preserve your environment for security reasons, especially not$PATH. If you are allowed to, you may trysudo -E svn(seeman sudo). For the default $PATH and default kept environments seesudo -l. – ridgy Jan 31 '17 at 13:13sudo echo $PATHthen $PATH will be resolved by the calling shell, not thesudoshell. Andwhereisdoes not only look in$PATHand$MANPATH, but also in some hardcoded places (trywhereis -lto see the whole tree). If instead you usewhichcommand, you will see the difference. Orsudo suand theecho $PATH. – ridgy Jan 31 '17 at 14:49