newbie help!
Ashley Smith
Ashley.Smith@hewittbaconwoodrow.com
Fri, 15 Nov 2002 16:41:38 +0000
This is a multipart message in MIME format.
--------------InterScan_NT_MIME_Boundary
Content-Type: multipart/alternative;
boundary="=_alternative 005BA9B480256C72_="
--=_alternative 005BA9B480256C72_=
content-type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: Quoted-Printable
hi,
i'm trying to send some simple commands to a UNIX server via an=
SSH session, and view the response. For example, i'd like to change
dir=
ectory remotely, then do and "ls -l", and view the directory contents.
So f=
ar, I have something like this:
SSH2SimpleClient sshClient = new SS=
H2SimpleClient(sServer, iPort,
sServerId, sServerPwd);
ByteArrayOut=
putStream outStream = new ByteArrayOutputStream();
ByteArrayOutputStr=
eam errStream = new ByteArrayOutputStream();
BufferedOutputStream buf=
OutStream = new
BufferedOutputStream(outStream);
BufferedOutputStre=
am bufErrStream = new
BufferedOutputStream(errStream);
SSH2Consol=
eRemote remoteConsole = new
SSH2ConsoleRemote(sshClient.getConnection(),bu=
fOutStream,bufErrStream);
remoteConsole.command("ls -l")
the comman=
d() method is returning true, and i know the connection is good
because i'=
ve used it to transfer files successfully. I was hoping to see
the output =
of the "ls -l" in bufOutStream, but i'm not seeing anything in
either bufE=
rrStream or bufOutStream.
Any ideas what i'm doing wrong?
tia for any =
help!
This material has been checked by us for computer viruses and alt=
hough none has been found by us, we cannot guarantee that it is completely f=
ree from such problems and we do not accept any liability for loss or damage=
which may be caused. Please therefore check any attachments for viruses be=
fore using them on your own equipment. If you do find a computer virus plea=
se inform us immediately so that we may take appropriate action.
This com=
munication is intended solely for the addressee and is confidential.
If y=
ou are not the intended recipient, any disclosure, copying, distribution or =
any action taken or omitted to be taken in reliance on it, is prohibited and=
may be unlawful.
Visit our website at http://www.hewittbaconwoodrow.co.u=
k (UK) or http://www.hewittbaconwoodrow.ie (Ireland)
--=_alternative 005BA9B480256C72_=
content-type: text/html; charset="us-ascii"
Content-Transfer-Encoding: Quoted-Printable
<br><font size=2 face="sans-serif">hi,</font>
<br><font size=2 face="sans=
-serif"> i'm trying to send some simple commands =
to a UNIX server via an SSH session, and view the response. For example, i'd=
like to change directory remotely, then do and "ls -l", and view =
the directory contents.</font>
<br><font size=2 face="sans-serif">So far, I=
have something like this:</font>
<br>
<br><font size=2 face="sans-serif">=
SSH2SimpleClient sshClient = new SSH2SimpleClient(sServ=
er, iPort, sServerId, sServerPwd);</font>
<br><font size=2 face="sans-serif=
"> ByteArrayOutputStream outStream = new ByteArrayOutput=
Stream();</font>
<br><font size=2 face="sans-serif"> By=
teArrayOutputStream errStream = new ByteArrayOutputStream();</font>
<br><fo=
nt size=2 face="sans-serif"> BufferedOutputStream bufOut=
Stream = new BufferedOutputStream(outStream);</font>
<br><font size=2 face==
"sans-serif"> BufferedOutputStream bufErrStream = new Bu=
fferedOutputStream(errStream);</font>
<br>
<br><font size=2 face="sans-ser=
if"> SSH2ConsoleRemote remoteConsole = new SSH2ConsoleRe=
mote(sshClient.getConnection(),bufOutStream,bufErrStream);</font>
<br><font=
size=2 face="sans-serif"> remoteConsole.command("ls=
-l")</font>
<br>
<br><font size=2 face="sans-serif">the command() me=
thod is returning true, and i know the connection is good because i've used =
it to transfer files successfully. I was hoping to see the output of the &qu=
ot;ls -l" in bufOutStream, but i'm not seeing anything in either bufErr=
Stream or bufOutStream.</font>
<br>
<br><font size=2 face="sans-serif">Any=
ideas what i'm doing wrong?</font>
<br>
<br><font size=2 face="sans-serif=
">tia for any help!</font>
<font face="Helv" size=3 color=#000000 ></font><=
br><font face="Helv" size=3 color=#000000 ></font><br><font face="Helv" size=
=3 color=#000000 >This material has been checked by us for computer viruses =
and although none has been found by us, we cannot guarantee that it is compl=
etely free from such problems and we do not accept any liability for loss or=
damage which may be caused. Please therefore check any attachments for vir=
uses before using them on your own equipment. If you do find a computer vir=
us please inform us immediately so that we may take appropriate action.</fon=
t><br><font face="Helv" size=3 color=#000000 ></font><br><font face="Helv" s=
ize=3 color=#000000 >This communication is intended solely for the addressee=
and is confidential.</font><br><font face="Helv" size=3 color=#000000 ></fo=
nt><br><font face="Helv" size=3 color=#000000 >If you are not the intended r=
ecipient, any disclosure, copying, distribution or any action taken or omitt=
ed to be taken in reliance on it, is prohibited and may be unlawful.</font><=
br><font face="Helv" size=3 color=#000000 ></font><br><font face="Helv" size=
=3 color=#000000 >Visit our website at http://www.hewittbaconwoodrow.co.uk (=
UK) or http://www.hewittbaconwoodrow.ie (Ireland)</font><br>
--=_alternative 005BA9B480256C72_=--
--------------InterScan_NT_MIME_Boundary--