How to read from stdin with dbclient
Tobias Dussa (SCC <tobias.dussa <at> kit.edu>
2012-08-30 10:39:50 GMT
I'm trying to ship something to a script on a remote machine via SSH
and catch its output.
As an example, let's say that user foo on machine bar has "cat"
defined as her shell. Thus, after connecting to bar as foo, anything
that is sent to bar is sent back.
Theoretically, piping something into the ssh command should result in
that something being thrown back. This does indeed work as expected
when using openssh's ssh client, like this:
echo baz | ssh -qi IDENTITY foo <at> bar
Trying the same with dbclient yields "Failed reading termmodes" for
echo baz | dbclient -i DB_IDENTITY foo <at> bar
This points to the fact that no pty is available, which is correct, of
course, and can be prevented by using the -T switch, which tells
dbclient not to allocate a pty:
echo baz | dbclient -T -i DB_IDENTITIY foo <at> bar
However, this is where things go wrong. The "baz" string does still
indeed arrive at the remote server and is processed by foo's shell,
but is not printed by dbclient. This is unfortunate as I really need
to capture the output.
So, the obvious question is, how can I get to the output?
THX & Cheers,
E Pluribus Unix
Karlsruhe Institute of Technology (KIT)
Steinbuch Centre for Computing (SCC)
CERT Manager, CA Manager
76131 Karlsruhe, Germany
Phone: +49 721 608-42479
Fax: +49 721 608-9-42479
Email: tobias.dussa <at> kit.edu
KIT – University of the State of Baden-Wuerttemberg and
National Laboratory of the Helmholtz Association