1834694 Members
2298 Online
110069 Solutions
New Discussion

ssh PATH problem

 
Michael Langas
Advisor

ssh PATH problem

I'm trying to connect wincvs to a cvs on my HP 11i server. Wincvs uses the following ssh format:
ssh -l username hostname commandstring

Because a shell never actually starts, I'm stuck with the path HP used at compile time. The ssh docs seem to indicate a few possible ways to override this path, (environment and sshrc files) but none of them seem to work. Can anyone recommend a way around this problem?

Thanks in advance,

Mike
7 REPLIES 7
Donny Jekels
Respected Contributor

Re: ssh PATH problem

okay, i don't understand what you really want but lets try.


for the sshd server look for the sshd_conf file and in there is PATH for sshd deamon.

/sbin/init.d/ssh stop; /sbin/init.d/ssh start

for the client, ssh uses your own environment.

do a env and see what your path is.

else please explain your actuall problem


peace
donny
"Vision, is the art of seeing the invisible"
Michael Langas
Advisor

Re: ssh PATH problem

I figured out a solution although it wasn't the one I was originally looking for.

wincvs uses ssh to run cvs commands on the cvs server. for example, it might send:
ssh -l username hostname cvs -d etc...

This assumes the command cvs is actually in the path. The problem is that when you use ssh in this way you are stuck with the path that defined at compile time. It doesn't source .profile or anything because it is not actually starting a shell. It's kind of like how things run from cron.

The solution I found was to set the CVS_SERVER environment variable to /opt/cvs/bin/cvs on the windows workstation. this changes the above command string to:
ssh -l username hostname /opt/cvs/bin/cvs etc...

This works, but now I have to set this on every users workstation that will be using CVS. A better solution would be to find a way to override the path that was defined at compile time.
Jan Zalman
Advisor

Re: ssh PATH problem

I met same problem 2 days ago. As you said,
when sshd invoking remote command, it is not using .profile. Environment
variables like PATH are hardcoded into ssh.
However, sshd can override these defaults using the file ${HOME}/.ssh/environment
on remote machine.
You can allow this behavior editing the
/opt/ssh/etc/sshd_config file
"PermitUserEnvironment yes" (restart sshd).
Beware, environment file is not executed, just scanned. Only accepted records are those like PATH=/usr/bin:/usr/local/bin:/whatever/cvs/bin. No export, no external commands. I had tried out the default PATH first (ssh server "env"), than added the cvs path and enscribed the result to environment file. It works ok. Regards.


Time and loyalty cannot be bought.
Steven E. Protter
Exalted Contributor

Re: ssh PATH problem

Strange my ssh(3.6 p2 hp port) works fine with reading environment.

It started giving errors, so I kicked up maxusers which kicks up nproc and nfile, reinstalled and the error seems to be gone for now.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Langas
Advisor

Re: ssh PATH problem

Jan,

Thanks of the suggestion. The only problem I have with doing it that way is that I would have to do it for all users using cvs. I would like to do it in one place to take care of it for everyone.

Thanks,


Mike
Jan Zalman
Advisor

Re: ssh PATH problem

Setting env for all could be handy for me, too, but I haven't clue. (except the
piggy way just symlink cvs in /usr/bin ;-)
Regards
Time and loyalty cannot be bought.
Olivier Drouin
Trusted Contributor

Re: ssh PATH problem

You have to write some wrapper scripts around the command you invoke over ssh if they need specific environment variables.