You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jeff Self <js...@nngov.com> on 2005/02/24 18:05:40 UTC

problem connecting to OS X hosts using svn+ssh

I am unable to connect to two different computers running OS X.  If I'm
logged on either one, I can type 'svn list file:///Users/me/svn' to get
a list of my projects.  But I can't get to it from another computer.  I
even tried connecting to my iBook from my iBook using svn+ssh and got
the same error.  The error is:

bash: line 1: svnserve: command not found
svn: Connection closed unexpectedly.

The first line of the error message doesn't make sense.  If I'm logged
in to that computer, I can type svnserve and get the message about
specifying which flag to use.

Like I said, I can't get it to work with my iBook or my Mac at home.  I
am able to connect to my Linux box running Subversion from my iBook.

-- 
Jeff Self
Information Technology
City of Newport News
757.926.3741


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem connecting to OS X hosts using svn+ssh

Posted by Dave Camp <da...@thinbits.com>.
On Feb 24, 2005, at 11:08 PM, Zachary Pincus wrote:

> So now the question is which dotfiles do bash or tcsh run when invoked 
> non-interactively (which is how sshd invokes them when it uses the 
> shell to execute a command). A quick trip to the bash and tcsh man 
> pages answers this question:
> man tcsh:
>> Non-login  shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc 
>> on
>> startup.
>
> The bash man page is less clear, but it appears that .bashrc is read 
> when rshd (or, presumably, sshd) executes bash:
>> Bash attempts to determine when it is being run  by  the  remote  
>> shell
>> daemon,  usually  rshd.  If bash determines it is being run by rshd, 
>> it
>> reads and executes commands from ~/.bashrc, if that file exists and  
>> is
>> readable.
>
> So in either case, the .bashrc or .tcshrc file should be invoked, 
> provided that sshd is in fact running the command from a shell (I 
> think there are ways to configure it to not do so, but they are not 
> common, and then in that case the error message would be 'sshd: 
> svnserve: command not found' or something similar, not 'tcsh:...'.)
> Likewise, etc/bashrc and etc/csh.cshrc get read in either case.

On our machines, we have never observed .tcshrc being run when using 
ssh in this manner. Adding the svn path to PATH in this manner was not 
effective. Our bash users reported the same thing. Weird.

> The reason this bites Mac users particularly is that many have 
> installed subverison via fink, which puts it in /sw/bin. This needs a 
> special PATH entry, which sometimes ends up in a .login or .profile 
> file.

It also bites if you installed from the Installer packages that are 
linked to from the main svn page. They install into /usr/local/bin, 
which Apple for some reason has not made a standard search location.

> Now, we can easily test the claim that (at least with tcsh), sshd does 
> in fact invoke tcsh in such a manner that it reads the .tcshrc file in 
> my home directory:
>
> 1) Note that I've installed svn via fink, so it lives in /sw/bin. The 
> only place that '/sw/bin' is added to my path is in a single line my 
> ~/.tchsrc on the machine that is the subversion server. (I grep -r'd 
> etc/* for any mention of /sw/, and there was none.)
> 2) With this single line intact in the ~/.tchsrc, something like: 'svn 
> ls svn+ssh://host/repository' works.
> 3) When I comment out the single line in the .tcshrc file that adds 
> /sw/bin to the path, then the same command fails with the message 
> 'tcsh: svnserve: Command not found.'
> 4) Restoring the line restores svn functionality.

Not sure what to say about that. It did not work for us on 3 different 
10.3.x machines.

In any event, at least we have now documented all this in the list 
archives. Maybe it will help others in the future...

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem connecting to OS X hosts using svn+ssh

Posted by Zachary Pincus <zp...@stanford.edu>.
> No. sshd does not run the users ~/.bash* or ~/.tcsh* files when 
> executing a remote command. Those files are only run if the user is 
> logging in and starting an interactive shell. This has come up many 
> times on the list... it seems to bite many Mac users (myself 
> included).
>
> Depending on what your default shell is, you need to modify (or add) 
> the PATH variable in the following files (taken from an Xserve at 
> work):
>
> /etc/bashrc:export PATH=$PATH:/usr/local/bin
> /etc/csh.cshrc:      setenv PATH "$PATH"":/usr/local/bin"
> /etc/csh.login:setenv PATH 
> "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"

This isn't exactly the whole story...
When sshd executes a command, it does so using the user's default 
shell, run as that user. This can be easily verified because the the 
error when the path variable is incorrectly set is:
'tcsh: svnserve: Command not found.'
or
'bash: svnserve: Command not found.'
depending on the user's shell.

So now the question is which dotfiles do bash or tcsh run when invoked 
non-interactively (which is how sshd invokes them when it uses the 
shell to execute a command). A quick trip to the bash and tcsh man 
pages answers this question:
man tcsh:
> Non-login  shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc on
> startup.

The bash man page is less clear, but it appears that .bashrc is read 
when rshd (or, presumably, sshd) executes bash:
> Bash attempts to determine when it is being run  by  the  remote  shell
> daemon,  usually  rshd.  If bash determines it is being run by rshd, it
> reads and executes commands from ~/.bashrc, if that file exists and  is
> readable.

So in either case, the .bashrc or .tcshrc file should be invoked, 
provided that sshd is in fact running the command from a shell (I think 
there are ways to configure it to not do so, but they are not common, 
and then in that case the error message would be 'sshd: svnserve: 
command not found' or something similar, not 'tcsh:...'.)
Likewise, etc/bashrc and etc/csh.cshrc get read in either case.

The files that emphatically *do not* get read are /etc/profile, 
~/.profile, /etc/csh.login, and ~/.login.
So if the path is set in the any of these files, problems arise.

The reason this bites Mac users particularly is that many have 
installed subverison via fink, which puts it in /sw/bin. This needs a 
special PATH entry, which sometimes ends up in a .login or .profile 
file.

Now, we can easily test the claim that (at least with tcsh), sshd does 
in fact invoke tcsh in such a manner that it reads the .tcshrc file in 
my home directory:

1) Note that I've installed svn via fink, so it lives in /sw/bin. The 
only place that '/sw/bin' is added to my path is in a single line my 
~/.tchsrc on the machine that is the subversion server. (I grep -r'd 
etc/* for any mention of /sw/, and there was none.)
2) With this single line intact in the ~/.tchsrc, something like: 'svn 
ls svn+ssh://host/repository' works.
3) When I comment out the single line in the .tcshrc file that adds 
/sw/bin to the path, then the same command fails with the message 
'tcsh: svnserve: Command not found.'
4) Restoring the line restores svn functionality.

ergo, sshd is in fact invoking tcsh in such a manner that it reads my 
.tcshrc file.

Zach Pincus

Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem connecting to OS X hosts using svn+ssh

Posted by Tom Mornini <tm...@infomania.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm not exactly arguing here, but on my OS X Server system,
.bash_profile must be in use, or I'd be having the same
problems.

How would sshd execute commands without a shell?

How can sshd launch a shell without the shell initializing?

ccm:~ tmornini$ sudo find / -name svn -ls
208574    0 drwxr-xr-x   14 svn      staff         476 Nov 14 22:37 
/Users/svn
209607  640 -rwxr-xr-x    1 root     wheel      327460 Oct 22 21:17 
/usr/local/bin/svn

ccm:~ tmornini$ cat /etc/bashrc    | grep local
ccm:~ tmornini$ cat /etc/csh.cshrc | grep local
ccm:~ tmornini$ cat /etc/csh.login | grep local

ccm:~ tmornini$ cat .bash_profile | grep local
export PATH=/usr/local/bin:/usr/local/pgsql/bin:$PATH

On Feb 24, 2005, at 10:20 PM, Dave Camp wrote:

> On Feb 24, 2005, at 12:56 PM, Zachary Pincus wrote:
>
>> It's possible that when sshd on the remote OS X machine tries to run 
>> svnserve on your behalf, it can't find the executable. Perhaps it's 
>> in a nonstandard location? (see this email to the svn list: 
>> http://svn.haxx.se/users/archive-2004-10/1027.shtml )
>>
>> That said, sshd should be executing svnserve within a shell that 
>> should have access to your PATH variables -- right? So if you can use 
>> svnserve when logged in via ssh, sshd should be able to run it too.
>
> No. sshd does not run the users ~/.bash* or ~/.tcsh* files when 
> executing a remote command. Those files are only run if the user is 
> logging in and starting an interactive shell. This has come up many 
> times on the list... it seems to bite many Mac users (myself 
> included).
>
> Depending on what your default shell is, you need to modify (or add) 
> the PATH variable in the following files (taken from an Xserve at 
> work):
>
> /etc/bashrc:export PATH=$PATH:/usr/local/bin
> /etc/csh.cshrc:      setenv PATH "$PATH"":/usr/local/bin"
> /etc/csh.login:setenv PATH 
> "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"

- -- 
- -- Tom Mornini
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCHshPzaKkuvKwKvcRAhAQAJ9z9XgqxsaeCesL/i4NiLrvYruZNwCfWsdk
xvjTmJROdMt5+RmtDPLO7Bg=
=IDVf
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem connecting to OS X hosts using svn+ssh

Posted by Dave Camp <da...@thinbits.com>.
On Feb 24, 2005, at 12:56 PM, Zachary Pincus wrote:

> It's possible that when sshd on the remote OS X machine tries to run 
> svnserve on your behalf, it can't find the executable. Perhaps it's in 
> a nonstandard location? (see this email to the svn list: 
> http://svn.haxx.se/users/archive-2004-10/1027.shtml )
>
> That said, sshd should be executing svnserve within a shell that 
> should have access to your PATH variables -- right? So if you can use 
> svnserve when logged in via ssh, sshd should be able to run it too.

No. sshd does not run the users ~/.bash* or ~/.tcsh* files when 
executing a remote command. Those files are only run if the user is 
logging in and starting an interactive shell. This has come up many 
times on the list... it seems to bite many Mac users (myself included).

Depending on what your default shell is, you need to modify (or add) 
the PATH variable in the following files (taken from an Xserve at 
work):

/etc/bashrc:export PATH=$PATH:/usr/local/bin
/etc/csh.cshrc:      setenv PATH "$PATH"":/usr/local/bin"
/etc/csh.login:setenv PATH 
"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem connecting to OS X hosts using svn+ssh

Posted by Zachary Pincus <zp...@stanford.edu>.
It's possible that when sshd on the remote OS X machine tries to run 
svnserve on your behalf, it can't find the executable. Perhaps it's in 
a nonstandard location? (see this email to the svn list: 
http://svn.haxx.se/users/archive-2004-10/1027.shtml )

That said, sshd should be executing svnserve within a shell that should 
have access to your PATH variables -- right? So if you can use svnserve 
when logged in via ssh, sshd should be able to run it too.

Try logging into the remote machine with ssh and seeing if you can 
execute svnserve. If you can't, that's the problem that you'll have to 
fix (probably a path issue). If you can, then perhaps there's some 
ssh/sshd configuration problem (maybe in one of your config files 
somewhere, ssh or sshd is set to NOT run commands in a subshell?) In 
this canse, try making a link from svnserve (where ever it is) to 
something like /usr/bin or some obvious place that sshd would look for 
it.

Zach Pincus

Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine



On Feb 24, 2005, at 10:05 AM, Jeff Self wrote:

> I am unable to connect to two different computers running OS X.  If I'm
> logged on either one, I can type 'svn list file:///Users/me/svn' to get
> a list of my projects.  But I can't get to it from another computer.  I
> even tried connecting to my iBook from my iBook using svn+ssh and got
> the same error.  The error is:
>
> bash: line 1: svnserve: command not found
> svn: Connection closed unexpectedly.
>
> The first line of the error message doesn't make sense.  If I'm logged
> in to that computer, I can type svnserve and get the message about
> specifying which flag to use.
>
> Like I said, I can't get it to work with my iBook or my Mac at home.  I
> am able to connect to my Linux box running Subversion from my iBook.
>
> -- 
> Jeff Self
> Information Technology
> City of Newport News
> 757.926.3741
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org