You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Sreedhar J (Jira)" <ji...@apache.org> on 2020/06/05 11:18:00 UTC

[jira] [Commented] (SSHD-1009) Support WinSCP shell interactions

    [ https://issues.apache.org/jira/browse/SSHD-1009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17126681#comment-17126681 ] 

Sreedhar J commented on SSHD-1009:
----------------------------------

[~gnodet]  Thanks for the fix.  Using the fix,  I have tested my code,  made some progress. This time  WinSCP able to establish the session, but after that it was hung.  Please see the attached image  and the below logs

30169 2020-06-05 16:26:45,650 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - handleChannelRequest(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) SSH_MSG_CHANNEL_REQUEST simple@putty.projects.tartarus.org wantReply=false
30169 2020-06-05 16:26:45,650 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - sendResponse(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) request=simple@putty.projects.tartarus.org result=ReplySuccess, want-reply=false
30170 2020-06-05 16:26:45,651 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - sendResponse(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) request=simple@putty.projects.tartarus.org no pending command
30170 2020-06-05 16:26:45,651 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - handleChannelRequest(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) SSH_MSG_CHANNEL_REQUEST shell wantReply=true
30189 2020-06-05 16:26:45,670 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - prepareChannelCommand(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[shell] prepared command
30190 2020-06-05 16:26:45,671 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - sendResponse(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) request=shell result=ReplySuccess, want-reply=true
30190 2020-06-05 16:26:45,671 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerSessionImpl - encode(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) packet #8 sending command=99[SSH_MSG_CHANNEL_SUCCESS] len=5
30191 2020-06-05 16:26:45,672 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - sendResponse(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) request=shell activate command
30191 2020-06-05 16:26:45,672 [NioProcessor-2] DEBUG org.apache.sshd.server.scp.ScpShell - start(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) starting runner for command=null
30232 2020-06-05 16:26:45,713 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - handleData(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) SSH_MSG_CHANNEL_DATA len=37
30234 2020-06-05 16:26:45,715 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.channel.Window - waitForSpace(Window[server/remote](ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])) available: 2147483647
30235 2020-06-05 16:26:45,716 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.channel.Window - waitAndConsume(Window[server/remote](ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])) - requested=31, available=2147483647
30235 2020-06-05 16:26:45,716 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.session.ServerSessionImpl - encode(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) packet #9 sending command=94[SSH_MSG_CHANNEL_DATA] len=40
157115 2020-06-05 16:28:52,596 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - handleEof(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) SSH_MSG_CHANNEL_EOF
157115 2020-06-05 16:28:52,596 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.scp.ScpShell - onExit(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[ScpShell[null]] exiting - value=0, message=
157116 2020-06-05 16:28:52,597 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerSessionImpl - close(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) Closing immediately
157117 2020-06-05 16:28:52,598 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - closeShell(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) exit code=0
157119 2020-06-05 16:28:52,600 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - sendEof(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) SSH_MSG_CHANNEL_EOF (state=Opened)
157120 2020-06-05 16:28:52,601 [NioProcessor-2] DEBUG org.apache.sshd.common.session.helpers.SessionTimeoutListener - sessionClosed(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) un-tracked
157120 2020-06-05 16:28:52,601 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.session.ServerSessionImpl - encode(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) packet #10 sending command=96[SSH_MSG_CHANNEL_EOF] len=5
157122 2020-06-05 16:28:52,603 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - sendExitStatus(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) SSH_MSG_CHANNEL_REQUEST exit-status=0
157122 2020-06-05 16:28:52,603 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.session.ServerSessionImpl - encode(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) packet #11 sending command=98[SSH_MSG_CHANNEL_REQUEST] len=25
157123 2020-06-05 16:28:52,604 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - close(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) Closing gracefully
157125 2020-06-05 16:28:52,606 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.channel.Window - Closing Window[server/local](ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])
157125 2020-06-05 16:28:52,606 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.channel.Window - Closing Window[server/remote](ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])
157132 2020-06-05 16:28:52,613 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerConnectionService - close(ServerConnectionService[ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]]) Closing immediately
157133 2020-06-05 16:28:52,614 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerConnectionService - stopHeartBeat(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) no heartbeat to stop
157133 2020-06-05 16:28:52,614 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - close(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) Closing immediately
157135 2020-06-05 16:28:52,616 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable - close(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[immediately=false] processing
157135 2020-06-05 16:28:52,616 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable - close(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[immediately=false] send SSH_MSG_CHANNEL_CLOSE
157135 2020-06-05 16:28:52,616 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.session.ServerSessionImpl - encode(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) packet #12 sending command=97[SSH_MSG_CHANNEL_CLOSE] len=5
157136 2020-06-05 16:28:52,617 [NioProcessor-2] DEBUG org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable - close(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[immediately=true] processing
157139 2020-06-05 16:28:52,620 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerConnectionService - unregisterChannel(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) result=ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]
157139 2020-06-05 16:28:52,620 [NioProcessor-2] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@4f343779) signal close complete immediately=true
157140 2020-06-05 16:28:52,621 [NioProcessor-2] DEBUG org.apache.sshd.server.scp.ScpShell - destroy(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[ScpShell[null]] - cancel pending future=true
157141 2020-06-05 16:28:52,622 [NioProcessor-2] DEBUG org.apache.sshd.server.scp.ScpShell - destroy(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[ScpShell[null]] - shutdown executor service - runners count=0
157141 2020-06-05 16:28:52,622 [NioProcessor-2] DEBUG org.apache.sshd.common.file.root.RootedFileSystem - close(C:\ApacheSCPTest)
157142 2020-06-05 16:28:52,623 [NioProcessor-2] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@748e99a3) signal close complete immediately=true
157146 2020-06-05 16:28:52,627 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - close(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[Immediately] closed
157147 2020-06-05 16:28:52,628 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerConnectionService - close(ServerConnectionService[ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]])[Immediately] closed
157147 2020-06-05 16:28:52,628 [NioProcessor-2] DEBUG org.apache.sshd.common.io.mina.MinaSession - close(MinaSession[local=0.0.0.0/0.0.0.0:1111, remote=/0:0:0:0:0:0:0:1:54075]) Closing immediately
157148 2020-06-05 16:28:52,629 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable - handleClosePacketWriteFailure(GracefulChannelCloseable[ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]])[immediately=false] failed (WriteToClosedSessionException) to write SSH_MSG_CHANNEL_CLOSE on channel: null
157148 2020-06-05 16:28:52,629 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - close(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[Immediately] state already Closed
157148 2020-06-05 16:28:52,629 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.session.ServerConnectionService - unregisterChannel(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) result=null
157148 2020-06-05 16:28:52,629 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@4122fa0d) signal close complete immediately=false
157149 2020-06-05 16:28:52,630 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@4b28b672) signal close complete immediately=false
157150 2020-06-05 16:28:52,631 [NioProcessor-2] DEBUG org.apache.sshd.common.io.mina.MinaSession - close(MinaSession[local=0.0.0.0/0.0.0.0:1111, remote=/0:0:0:0:0:0:0:1:54075])[Immediately] closed
157150 2020-06-05 16:28:52,631 [NioProcessor-2] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@33fa10fa) signal close complete immediately=true
157151 2020-06-05 16:28:52,632 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerSessionImpl - close(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075])[Immediately] closed
157151 2020-06-05 16:28:52,632 [sshd-ScpShell-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - onExit(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:54075]) code=0 message='' shell closed

> Support WinSCP shell interactions
> ---------------------------------
>
>                 Key: SSHD-1009
>                 URL: https://issues.apache.org/jira/browse/SSHD-1009
>             Project: MINA SSHD
>          Issue Type: New Feature
>    Affects Versions: 2.3.0
>            Reporter: Sreedhar J
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 2.5.0
>
>         Attachments: ApacheSCPSFTPServer.java, ApacheSCPSFTPServer.java, WinSCP_Error.png, WinSCP_Success_with _Linux_System.png
>
>
> Hi,
>  
> I am trying to setup the  SFTP/SCP server using Apache SSHD 2.3.0.  Was able to transfer a file using SCP from command line , but when I tried using WinSCP,  I get a error saying Server could not start the Shell.
>  
> 15:44:06.956 [NioProcessor-2] DEBUG org.apache.sshd.server.auth.keyboard.UserAuthKeyboardInteractive - doAuth(admin@ServerSessionImpl[null@/0:0:0:0:0:0:0:1:58407]) authenticate 1 responses result: true
> 15:44:06.956 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerUserAuthService - handleAuthenticationSuccess(admin@ServerSessionImpl[null@/0:0:0:0:0:0:0:1:58407]) SSH_MSG_USERAUTH_INFO_RESPONSE
> 15:44:06.963 [NioProcessor-2] INFO org.apache.sshd.server.session.ServerSessionImpl - Session admin@/0:0:0:0:0:0:0:1:58407 authenticated
> 15:44:06.965 [NioProcessor-2] DEBUG org.apache.sshd.common.session.helpers.ReservedSessionMessagesHandlerAdapter - handleIgnoreMessage(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) SSH_MSG_IGNORE
> 15:44:06.966 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerConnectionService - channelOpen(ServerConnectionService[ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]]) SSH_MSG_CHANNEL_OPEN sender=256, type=session, window-size=2147483647, packet-size=16384
> 15:44:06.982 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - init() service=ServerConnectionService[ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]] session=ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407] id=0
> 15:44:06.982 [NioProcessor-2] DEBUG org.apache.sshd.common.channel.Window - init(Window[server/local](ChannelSession[id=0, recipient=-1]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407])) size=2097152, max=2097152, packet=32768
> 15:44:06.983 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerConnectionService - registerChannel(ServerConnectionService[ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]])[id=0] ChannelSession[id=0, recipient=-1]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]
> 15:44:06.983 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - setRecipient(ChannelSession[id=0, recipient=-1]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) recipient=256
> 15:44:06.983 [NioProcessor-2] DEBUG org.apache.sshd.common.channel.Window - init(Window[server/remote](ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407])) size=2147483647, max=2147483647, packet=16384
> 15:44:06.983 [NioProcessor-2] DEBUG org.apache.sshd.common.channel.Window - init(Window[server/local](ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407])) re-initializing
> 15:44:06.983 [NioProcessor-2] DEBUG org.apache.sshd.common.channel.Window - init(Window[server/local](ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407])) size=2097152, max=2097152, packet=32768
> 15:44:06.985 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerConnectionService - operationComplete(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) send SSH_MSG_CHANNEL_OPEN_CONFIRMATION recipient=256, sender=0, window-size=2097152, packet-size=32768
> 15:44:06.986 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - handleChannelRequest(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) SSH_MSG_CHANNEL_REQUEST simple@putty.projects.tartarus.org wantReply=false
> 15:44:06.987 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - sendResponse(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) request=simple@putty.projects.tartarus.org result=ReplySuccess, want-reply=false
> 15:44:06.987 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - sendResponse(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) request=simple@putty.projects.tartarus.org no pending command
> 15:44:06.987 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - handleChannelRequest(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) SSH_MSG_CHANNEL_REQUEST shell wantReply=true
> 15:44:06.987 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - handleShell(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) - no shell factory
> 15:44:06.987 [NioProcessor-2] DEBUG org.apache.sshd.server.channel.ChannelSession - sendResponse(ChannelSession[id=0, recipient=256]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) request=shell result=ReplyFailure, want-reply=true
> 15:44:06.988 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerSessionImpl - close(ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:58407]) Closing immediately
>  
> Please let me know if I missing some configuration around SCP.
>  
> have attached the source code.
> Thanks and Regards,
> Sreedhar.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org