Hi,

I'm trying to set up SSHD (latest trunk) and use it with WinSCP under
Windows.
I've tested logging in using putty and openssh (from cygwin). It works.

I'm now trying to use WinSCP, I've added
        sshd.setCommandFactory(new ScpCommandFactory());
to my code but I just can't get it to work.

If I leave the SCP/Shell option to "Default", it issues a "shell" command to
SSHD and I see in the logs:
INFO org.apache.sshd.server.channel.ChannelSession - Received channel
request: shell
INFO org.apache.sshd.server.shell.ProcessShellFactory - Starting shell with
command: '[C:/cygwin/bin/sh.exe, -i, -l]' and env: {USERPROFILE=C:(...)

So the shell seem to be launched.
I then see:
INFO org.apache.sshd.server.session.ServerSession - Received SSH_MSG_IGNORE
(8 times)

And then the channel seems to get closed by WinSCP:
WARN org.apache.sshd.server.session.ServerSession - Exception caught
2010-02-15 17:31:15,920 26712016 ERROR [STDERR] (NioProcessor-3:)
java.io.IOException: An existing connection was forcibly closed by the
remote host
2010-02-15 17:31:15,920 26712016 ERROR [STDERR] (NioProcessor-3:)       at
sun.nio.ch.SocketDispatcher.read0(Native Method)
2010-02-15 17:31:15,920 26712016 ERROR [STDERR] (NioProcessor-3:)       at
sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:25)
2010-02-15 17:31:15,920 26712016 ERROR [STDERR] (NioProcessor-3:)       at
sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
2010-02-15 17:31:15,920 26712016 ERROR [STDERR] (NioProcessor-3:)       at
sun.nio.ch.IOUtil.read(IOUtil.java:206)
2010-02-15 17:31:15,920 26712016 ERROR [STDERR] (NioProcessor-3:)       at
sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
2010-02-15 17:31:15,920 26712016 ERROR [STDERR] (NioProcessor-3:)       at
org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:202)

WinSCP seem to complain as it is not able to parse the PWD:
. 2010-02-15 17:31:14.763 Using SCP protocol.
. 2010-02-15 17:31:14.763 Doing startup conversation with host.
. 2010-02-15 17:31:14.779 Skipping host startup message (if any).
> 2010-02-15 17:31:14.779 echo "WinSCP: this is end-of-file:0"
< 2010-02-15 17:31:15.810 Your group is currently "mkpasswd".  This
indicates that
< 2010-02-15 17:31:15.810 the /etc/passwd (and possibly /etc/group) files
should be rebuilt.
< 2010-02-15 17:31:15.810 See the man pages for mkpasswd and mkgroup then,
for example, run
< 2010-02-15 17:31:15.810 mkpasswd -l [-d] > /etc/passwd
< 2010-02-15 17:31:15.810 mkgroup  -l [-d] > /etc/group
< 2010-02-15 17:31:15.810 Note that the -d switch is necessary for domain
users.
< 2010-02-15 17:31:15.842 WinSCP: this is end-of-file:0
. 2010-02-15 17:31:15.842 Detecting variable containing return code of last
command.
. 2010-02-15 17:31:15.842 Trying "$status".
! 2010-02-15 17:31:15.842 $ echo "WinSCP: this is end-of-file:
> 2010-02-15 17:31:15.842 echo "$status" ; echo "WinSCP: this is
end-of-file:0"
! 2010-02-15 17:31:15.842 0"
< 2010-02-15 17:31:15.857 WinSCP: this is end-of-file:0
. 2010-02-15 17:31:15.857 Trying "$?".
! 2010-02-15 17:31:15.857 $ echo "$status" ; echo "WinSCP: this is
end-of-file:0
> 2010-02-15 17:31:15.873 echo "$?" ; echo "WinSCP: this is end-of-file:0"
! 2010-02-15 17:31:15.873 "
! 2010-02-15 17:31:15.888 $ echo "$?" ; echo "WinSCP: this is end-of-file:0"
< 2010-02-15 17:31:15.888 0
< 2010-02-15 17:31:15.888 WinSCP: this is end-of-file:0
. 2010-02-15 17:31:15.888 Getting current directory name.
> 2010-02-15 17:31:15.888 pwd ; echo "WinSCP: this is end-of-file:0"
! 2010-02-15 17:31:15.904 $ pwd ; echo "WinSCP: this is end-of-file:0"
< 2010-02-15 17:31:15.904 /cygdrive/c/Documents and Settings/patrick
< 2010-02-15 17:31:15.904 WinSCP: this is end-of-file:0
. 2010-02-15 17:31:15.904 Attempt to close connection due to fatal
exception:
* 2010-02-15 17:31:15.904 (ECommand) Error getting name of current remote
directory.
* 2010-02-15 17:31:15.904 Command 'pwd'
* 2010-02-15 17:31:15.920 failed with return code 0 and error message
* 2010-02-15 17:31:15.920 $ pwd ; echo "WinSCP: this is end-of-file:0".
. 2010-02-15 17:31:15.920 Closing connection.

Has anyone been able to use WinSCP with SSHD ?
What are the parameters to put in WinSCOP/SSHD in order to get them working
together ?

Best Regards,
Patrick

Reply via email to