path environment variables and ssh

Ted Pavlic ted at tedpavlic.com
Thu May 8 13:07:57 UTC 2008


OH, and don't forget to make sure your /etc/ssh/sshd_config has the line:

PermitUserEnvironment yes

Otherwise I don't think that .ssh/environment will get set. Your system 
administrator should be able to set that configuration flag for you (it 
doesn't seem like much of a security "hole").

Of course, as mentioned(-ish), you can short-circuit all of this by 
installing your own Mercurial distro in your home directory and hacking 
it to look for Py251.

--Ted

Ted Pavlic wrote:
> Of course, you can set PYTHONPATH with that file for sure.
> 
> So, if you've already short-circuited Mercurial via .hgrc, you should 
> have no trouble short-circuiting PYTHONPATH via .ssh/environment.
> 
> --Ted
> 
> Ted Pavlic wrote:
>> Try this. Create a file on your remote machine:
>>
>> ~/.ssh/environment
>>
>> where "~" is your home directory and ".ssh" is a directory immediately 
>> underneath it. In that "environment" file, put a line
>>
>> PATH=/usr/local/bin:/usr/bin:/bin:
>>
>> or something similar. Then try.
>>
>>  From the ssh man page, I KNOW that ssh will set environment variables 
>> out of that file. However, I'm not sure if you can override PATH via it. 
>> (IIRC, you can)
>>
>> --Ted
>>
>>
>> James Walker wrote:
>>> Hi.  I'm new to mercurial, and I haven't been able to figure out where 
>>> to define environment variables such that they will be seen by an ssh 
>>> remote command to a server running Mac OS X 10.4.  For instance it's not 
>>> ~/.profile, which works if I log in interactively.  This caused a 
>>> mercurial command with an ssh URL to fail because it couldn't find hg on 
>>> the server.  I got around that problem by using my local .hgrc file to 
>>> set the remote command to /usr/local/bin/hg.  But now I'm wondering 
>>> about the PYTHONPATH.  If the server's hg were using python 2.3.5 (which 
>>> comes standard with Mac OS X 10.4) rather than python 2.5.1 (which I 
>>> installed), would there be an error message, or would it just run 
>>> suboptimally?
>>> _______________________________________________
>>> Mercurial mailing list
>>> Mercurial at selenic.com
>>> http://selenic.com/mailman/listinfo/mercurial
>>>
> 

-- 
Ted Pavlic <ted at tedpavlic.com>



More information about the Mercurial mailing list