Quote:>does anyone know how to manipulate file descriptors from the shell given
>a process of terminal.
>what i want to is ssh into a remote host via one or more intermediate
>nodes. once i have a secure connection between the two endpoints i want
>to redirect stdout of a certain local program into stdin of the local
>ssh client. then my data would end up on stdout of my remote terminal
>which i want to redirect to a file instead of my local monitor.
>i would need three logins total. one remote ssh login for the secure
>channel. another remote ssh login to move remote file descriptors around
>(remote control), and a third local login to move file descriptors
>around (local control).
>can anyone help before i start trying to write code for this?
I don't know any way to manipulate descriptors of an existing process like
you suggest, either from the shell or a program (a process can manipulate
its *own* descriptors using dup2(), but not the descriptors of another
process). Why don't you just use ordinary pipes:
local-program | ssh remotehost 'cat > remote-file'
If you need to go through intermediate hosts, it could be:
local-program | ssh remote1 ssh remote2 'cat > remote-file'
It might be necessary to escape the quotes to make sure they're passed on
properly to the second ssh; I haven't tested it, so you'll need to play
with it to get it right.
--
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.