Hello,

I am trying to setup a basic SSH client using apache SSHD - 1.1.0 libraries. 
I'm using org.apache.sshd.server.SshServer available in the library, server 
running at 8000 port. My client code goes as follows :

SshClient client = SshClient.setUpDefaultClient();
client.start();
ClientSession session = client.connect("root", 
"192.168.56.101",8000).verify().getSession();
session.addPasswordIdentity("root");
ClientChannel channel;
channel = session.createChannel(Channel.CHANNEL_EXEC, "pwd");
channel.setOut(new NoCloseOutputStream(System.out));
channel.setErr(new NoCloseOutputStream(System.err));
channel.open().await();
channel.waitFor(EnumSet.of(ClientChannel.ClientChannelEvent.CLOSED), 0);
channel.close();
session.close(false);
client.stop();

Whenever I execute channel.open().await(); , I get the following error on 
server side:
Mar 31, 2017 8:22:40 AM org.apache.sshd.common.session.AbstractSession 
exceptionCaught
WARNING: 
exceptionCaught(ServerSessionImpl[null@/192.168.56.1:54877])[state=Opened] 
IllegalStateException: No current authentication mechanism for 
cmd=SSH_MSG_CHANNEL_OPEN

What is the error I'm doing. Please bear me since I'm starter here.. :)

Thanks
Ravikiran

Reply via email to