Re: How to call a remote program through SSH tunnel and pass a local file as parameter?
From: Antti Tolamo (usenet_at_linux.tola.org)
Date: Sat, 05 Feb 2005 04:15:24 +0200
Peter Meister wrote:
> Ok, If I would have the program on the local machine I could call this from the command line
> by a statment like
> myprog myfile.dat
> Unfortunately the program is on another machine installed. Between the two
> machines there is an already successfully running SSH connection.
> How do I call in this scenario the remote progr myprog and pass
> the local file myfile.dat?
Don't know what SSH or OS you use, but for OpenSSH I and Linux can guide
You could try this:
cat > myfile.dat | ssh -l your_login your_host "myprog < cat"
basically you read file to stream/pipe first, then open connection
and do commands combining the command and the output as one on
the other end.
Depending is the myprog on path or not, you may need to use
./myprog if it's not one the path but on folder where you log on.
Of course I don't know how the program at other end works. If
it takes input above should work, if it reads information
from a file it can be another thing.
I haven't tested combining the command to input, but the piping
and doing command above way do work.