RE: Weird behaviour using executeCommand

"Palkonda, Vamshidhar R \(Vamshi\)" <[email protected]>
Newsgroups gmane.comp.java.sshtools.user
Message-ID <FA00572E7C7F3D4692A8987213A7892C0907CDFF@cof110avexu1.global.avaya.com>
I just recently downloaded source. I tried to execute the PasswordConnect example
somehow I was not success. I looked at the source of the PasswordAuthenticationClient and in its authenticate method it was refering to
SshMsguserAuthPwdChangeReq

Is that right

All I wanted is connect using username and password and execute the command.

It seems you have been already past this stage, could you direct me

thanks
Vam

-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Rudolf
Visagie
Sent: Tuesday, November 02, 2004 9:29 AM
To: [email protected]
Subject: [Sshtools-users] Weird behaviour using executeCommand


I'm using SessionChannelClient.executeCommand to run a bash script called 
test.sh on a remote machine.

test.sh - Version I
-------------------
ls -la > temp.out

test.sh - Version II
--------------------
$ORACLE_HOME/bin/sqlplus enerbench/hcnbrn@chaos @temp.sql > temp.out

With version I, everything works find and a file temp.out is created with the 
contents of the directory.
With version II of test.sh, a file called temp.out is created, but with size 
0. If I execute test.sh from a PuTTY terminal session, everything works fine 
and the temp.out file is created.

I've got no idea what causes this, but it seems like the SSH 
connection/channel (?) is broken before the sqlplus command can finish 
executing.

Any help would be appreciated.

Thanks


Here's the a snippet of my code:

SshClient ssh = new SshClient();
ssh.setSocketTimeout(30000);

SshConnectionProperties properties = new SshConnectionProperties();
properties.setHost(extractionSetup.getSshHost().getHostName());
properties.setPrefPublicKey("ssh-dss");
  
ssh.connect(properties, new IgnoreHostKeyVerification());	  	  

PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
               
pwd.setUsername(extractionSetup.getSshHost().getUsername());	      
pwd.setPassword(extractionSetup.getSshHost().getPassword());
         
int result = ssh.authenticate(pwd);

if (result != AuthenticationProtocolState.COMPLETE) {
	throw new SSHHostException("Invalid username/password.");
} else { 
	ByteArrayInputStream bais = new ByteArrayInputStream
(extractionSetup.getSQLPlusScript().getBytes());
	ScpClient scpClient = new ScpClient(ssh, true, null);
	scpClient.put(bais, bais.available(), "temp.sql", "temp.sql");	  
		
  	
  	SessionChannelClient session = ssh.openSessionChannel();	
	  
    
  	session.executeCommand("./test.sh");
  




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Sshtools-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sshtools-users


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id065&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.