Giter VIP home page Giter VIP logo

j2ssh-maverick's People

Contributors

ludup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

j2ssh-maverick's Issues

ScpConnect example not work

When input password, the process just waiting.
Server and password is following:

Hostname: 66.42.44.175
Username [Enter for bibi]: root
Connecting to 66.42.44.175
The host |1|lYaziWXZ7wM6fIo0kD7lERvviCg=|W46arhY3ppGAaePPR3suy6WWFic= is currently unknown to the system
The MD5 host key (ssh-rsa) fingerprint is: b5:b7:83:49:50:97:26:85:e1:9e:45:e7:65:18:09:72
The SHA1 host key (ssh-rsa) fingerprint is: 41:fb:72:30:24:84:6e:5b:0a:17:82:01:29:f8:14:74:53:47:81:d0
The SHA256 host key (ssh-rsa) fingerprint is: fe:3e:6f:90:28:8b:7c:b9:3e:2b:76:96:11:03:90:21:28:b6:63:5b:7f:52:44:ef:6d:dd:d7:1e:73:f5:6f:a2
Do you want to allow this host key? [Yes|No|Always]: yes
Password: u9J=az)c2-7#mK]K

Cd method of SFTP Client not working

Team,

I am using maverick-all 1.4.39 in my application to do SFTP with remote server. I logged in as root. My default dirctory is root.

Issue 1: When I tried to cd(".."), it return default dirctory. It shoud be return .
Issue2: I called cdup() method instead of cd(".."). It returned \ . Then I did ls(). It return nothing.

Why nothing worked for \ . I want to go to my home dirctory and get files under home. Please help me to achieve this.

Thank you very much in advance.

Thanks & Regards
Revathi Praba

SftpClient.pwd() is returning incorrect results for windows

Hi Team,

I am using maverick-legacy-client 1.7.14 licensed version.

in my code:

"SftpClient.copyRemoteDirectory(rfdir,lfdir,true,false,true,null);" throwing below exception, this is because the SftpClient.pwd() is returning incorrect path, the path is coming with a forward slash as a prefix (eg: /C:/Users/Username/).
This is happening only for windows for linux it is working fine.

appriciate your help, since we are licensed customers, please let me know where I can raise a support ticket.

2023-10-18 16:00:59,326 WARN [com.optinuity.c2o.proxyagt.SshProcessMgr] [ Thread-47] CachedSshClient 2 - No such file
com.maverick.sftp.SftpSubsystemChannel.extractAttributes(SftpSubsystemChannel.java:2365)
com.maverick.sftp.SftpSubsystemChannel.getAttributes(SftpSubsystemChannel.java:2347)
com.maverick.sftp.SftpSubsystemChannel.getAttributes(SftpSubsystemChannel.java:2299)
com.sshtools.sftp.SftpClient.cd(SftpClient.java:542)
com.sshtools.sftp.SftpClient.copyRemoteDirectory(SftpClient.java:2844)
com.optinuity.c2o.proxyagt.CachedSshClient.recursiveGetDir(CachedSshClient.java:847)
com.optinuity.c2o.servicegroup.process.MonitoredSshProcess.recoverProcResults(MonitoredSshProcess.java:567)
com.optinuity.c2o.servicegroup.process.MonitoredSshProcess.run(MonitoredSshProcess.java:1019)
java.lang.Thread.run(Thread.java:748)

Exception appears when trying to ping using the following method

08:16:38,991 ERROR [stderr] (172.23.38.2:22[0]) Dec 5, 2016 8:16:38 AM [Plug-in standard error]: java.lang.NullPointerException
08:16:38,992 ERROR [stderr] (172.23.38.2:22[0]) Dec 5, 2016 8:16:38 AM [Plug-in standard error]: at com.sshtools.ssh2.Ssh2Client.isAuthenticated(Ssh2Client.java:382)

@OverRide
protected boolean ping() {
System.out.println("Session " + session);
return !session.isClosed() && sck.isAuthenticated() && sck.isConnected();
}

Ssh2HostbasedAuthentication not work

I have run SSH2HostbasedConnect class by change private key file to my own, but allways got
INFO: Authentication failed error.

info:
username:root
server:CentOS 6 x64
server authorized_keys fifle:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCN3IEHqmfEIUKh4Rdhh/0McuKVVfBsAil2mlLoRl+2oDdvCC8TaREpqrgv7s/+N6KDGt3x2TT8E2LS32vWp/a01zcvLmUUizpaFHeiL0ji6XFRkSzWxm3/Z1AVT16H/fLIpa5wNTx4Dg++jtLY1iLw205CNILIxur88fiqUg7aPw== root

client: ubuntu 18.04
client private key file:
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCN3IEHqmfEIUKh4Rdhh/0McuKVVfBsAil2mlLoRl+2oDdvCC8T
aREpqrgv7s/+N6KDGt3x2TT8E2LS32vWp/a01zcvLmUUizpaFHeiL0ji6XFRkSzW
xm3/Z1AVT16H/fLIpa5wNTx4Dg++jtLY1iLw205CNILIxur88fiqUg7aPwIDAQAB
AoGACY1ojtiVpipLL1VV2rZqfrUZts6TouI+YoMfxA5BEa4WLX7SlK8FfdXGE0w0
azzZz5Q2j7t9it/PTr3GqCylOwwsgsAcofoL0rQFAAkcgodTCU6j8xrs5fUCTx93
7syHgJEi3a2CytwMWESWxbNCql7GSTRaBqOvT1A6bMFDq9kCQQDexI/DNpihOlhY
ioYYQy/gc9moA/y1Vgqk6spfAXrNAAvE5D+4JUutarDS9/RmZjGu8dINcKjCgrQk
2a4SmYD7AkEAowYlyu8/XquslXuFqZU8732iglmnQcOdohGEnTs3R6u6OwdmtN6I
n5L+exzzDZ7VtrxjeCfwAFl96FfWJy9wjQJAIGTA6wgzZa6QTj/GhByxB5iRHAeI
Ze4fGiAyUWJrswfArl7qjSKPQKZ1FBiOZ52Qt/neK6ooQDC1dW5aC8ZapQJAXpSE
fJYNR9mFyTvesiJZNgDHtaRZ+zeITqynKalfSv+AjhqfJbQtw5a+eaK0CGTsTJZD
h0R0Y1+IQrIjFpzZSQJAeiIvqSs4oDe7kcapCB1ln4dfajn4YvxJ3twQidIgLVsX
zU5TT24v5H1EFg+BqPwzQcuhE3fETD1lvTOTq+h/Vg==
-----END RSA PRIVATE KEY-----

EOF received from remote side

Hi,
We are using j2ssh maverick version-1.5.5 , but while connecting to remote linux server we are getting the following SshException: EOF received from remote side in stacktrace:

03-03-2017 16:01:57 IST INFO [SSH2Service.java:271] - job-1f911fa1-2966-4c65-a099-c49f28ed3092: Executing command using channel type exec
03-03-2017 16:01:57 IST ERROR [SSH2Helper.java:82] - job-1f911fa1-2966-4c65-a099-c49f28ed3092: SSHException occured while executing command : EOF received from remote side [Unknown cause]
com.sshtools.ssh.SshException: EOF received from remote side [Unknown cause]
at com.sshtools.ssh2.TransportProtocol.readWithTimeout(TransportProtocol.java:597) ~
at com.sshtools.ssh2.TransportProtocol.readMessage(TransportProtocol.java:747) ~
at com.sshtools.ssh2.TransportProtocol.nextMessage(TransportProtocol.java:571) ~
at com.sshtools.ssh.message.SshMessageRouter.blockForMessage(SshMessageRouter.java:297) ~
at com.sshtools.ssh.message.SshMessageRouter.access$000(SshMessageRouter.java:44) ~
at com.sshtools.ssh.message.SshMessageRouter$MessagePump.run(SshMessageRouter.java:370) 

com.sshtools.ssh.SshIOException

Hi,
SSH command execution success but getting following error while getting command execution result.

Below is my code snippet.

public String getChannelOutput(InputStream inputStream) {
        InputStreamReader inputStreamReader = null;
        BufferedReader bufferedReader = null;
        StringBuilder builder = null;
        try {
            if(inputStream != null){
                inputStreamReader = new InputStreamReader(inputStream);
                bufferedReader = new BufferedReader(inputStreamReader);
                String line = bufferedReader.readLine();
                builder = new StringBuilder();
                while(line != null){
                    builder.append(line);
                    builder.append('\n');
                    line = bufferedReader.readLine();
                }
                return builder.toString();
            }else{
                return "Channel input stream is null";
            }
        } catch (Exception e) {
            FlintLogger.JOB_LOGGER.error("Error in Channel output due to : "+e.getLocalizedMessage(),e);
            return "Error in Channel output due to : "+e.getLocalizedMessage();
        }finally{
            if(inputStreamReader != null){
                try {
                    inputStreamReader.close();
                } catch (Exception e2) {
                    FlintLogger.JOB_LOGGER.error("Exception occured while closing input stream reader",e2);
                }
                inputStreamReader = null;
            }
            if(bufferedReader != null){
                try {
                    bufferedReader.close();
                } catch (Exception e2) {
                    FlintLogger.JOB_LOGGER.error("Exception occured while closing buffered reader",e2);
                }
                bufferedReader =null;
            }
        }
    }

Call to above function :

channelResult = session.getInputStream();
getChannelOutput(channelResult);   

com.sshtools.ssh.SshIOException
at com.sshtools.ssh2.Ssh2Channel$ChannelInputStream.read(Ssh2Channel.java:1160) ~[flint-ssh-connector-1.0.0.0-all.jar:?]
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) ~[?:1.8.0_71]
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) ~[?:1.8.0_71]
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) ~[?:1.8.0_71]
at java.io.InputStreamReader.read(InputStreamReader.java:184) ~[?:1.8.0_71]
at java.io.BufferedReader.fill(BufferedReader.java:161) ~[?:1.8.0_71]
at java.io.Buffere
dReader.readLine(BufferedReader.java:324) ~[?:1.8.0_71]
at java.io.BufferedReader.readLine(BufferedReader.java:389) ~[?:1.8.0_71]
at com.infiverve.flint.connector.ssh2.SSH2Helper.getChannelOutput(SSH2Helper.java:230) ~[flint-ssh-connector-1.0.0.0-all.jar:?]
at com.infiverve.flint.connector.ssh2.SSH2Helper.executeCommand(SSH2Helper.java:75) ~[flint-ssh-connector-1.0.0.0-all.jar:?]
at com.infiverve.flint.connector.ssh2.SSH2Service.onRequest(SSH2Service.java:242) ~[flint-ssh-connector-1.0.0.0-all.jar:?]
at com.infiverve.flint.sdk.connectors.FlintConnectorBase.lambda$start$0(FlintConnectorBase.java:84) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.eventbus.impl.HandlerRegistration.handleMessage(HandlerRegistration.java:207) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.eventbus.impl.HandlerRegistration.handle(HandlerRegistration.java:201) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.eventbus.impl.EventBusImpl.lambda$deliverToHandler$127(EventBusImpl.java:498) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$18(ContextImpl.java:335) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$265(OrderedExecutorFactory.java:91) ~[flint-lib-1.0.0.0-all.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_71]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_71]
05-05-2016 13:09:20 IST ERROR [SSH2Helper.java:242] - Error in Channel output due to : null
com.sshtools.ssh.SshIOException
at com.sshtools.ssh2.Ssh2Channel$ChannelInputStream.read(Ssh2Channel.java:1160) ~[flint-ssh-connector-1.0.0.0-all.jar:?]
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) ~[?:1.8.0_71]
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) ~[?:1.8.0_71]
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) ~[?:1.8.0_71]
at java.io.InputStreamReader.read(InputStreamReader.java:184) ~[?:1.8.0_71]
at java.io.BufferedReader.fill(BufferedReader.java:161) ~[?:1.8.0_71]
at java.io.BufferedReader.readLine(BufferedReader.java:324) ~[?:1.8.0_71]
at java.io.BufferedReader.readLine(BufferedReader.java:389) ~[?:1.8.0_71]
at com.infiverve.flint.connector.ssh2.SSH2Helper.getChannelOutput(SSH2Helper.java:230) ~[flint-ssh-connector-1.0.0.0-all.jar:?]
at com.infiverve.flint.connector.ssh2.SSH2Helper.executeCommand(SSH2Helper.java:76) ~[flint-ssh-connector-1.0.0.0-all.jar:?]
at com.infiverve.flint.connector.ssh2.SSH2Service.onRequest(SSH2Service.java:242) ~[flint-ssh-connector-1.0.0.0-all.jar:?]
at com.infiverve.flint.sdk.connectors.FlintConnectorBase.lambda$start$0(FlintConnectorBase.java:84) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.eventbus.impl.HandlerRegistration.handleMessage(HandlerRegistration.java:207) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.eventbus.impl.HandlerRegistration.handle(HandlerRegistration.java:201) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.eventbus.impl.EventBusImpl.lambda$deliverToHandler$127(EventBusImpl.java:498) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$18(ContextImpl.java:335) ~[flint-lib-1.0.0.0-all.jar:?]
at io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$265(OrderedExecutorFactory.java:91) ~[flint-lib-1.0.0.0-all.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_71]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_71]

Hangs forever

Trying to unload a task on a remote macOS machine. The thread hangs forever on the shellprocess drain method.
Logs:
DEBUG - There are now 2 active connections on client connection manager
DEBUG - Firing EVENT_CONNECTED success=true
DEBUG - Sent local identification string SSH-2.0-MaverickSynergy
DEBUG - Remote client version OK
DEBUG - Firing EVENT_NEGOTIATED_PROTOCOL success=true
DEBUG - Posting SSH_MSG_KEX_INIT
DEBUG - Sent SSH_MSG_KEX_INIT
DEBUG - Received SSH_MSG_KEX_INIT
DEBUG - Remote Key Exchanges: [email protected],curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
DEBUG - Remote Public Keys: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
DEBUG - Remote Ciphers CS: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
DEBUG - Remote Ciphers SC: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
DEBUG - Remote Macs CS: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG - Remote Macs SC: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG - Remote Compression CS: none,[email protected]
DEBUG - Remote Compression SC: none,[email protected]
DEBUG - Lang:
DEBUG - First Packet Follows: false
DEBUG - Local Key Exchanges: diffie-hellman-group-exchange-sha256,[email protected],curve25519-sha256,diffie-hellman-group18-sha512,diffie-hellman-group17-sha512,diffie-hellman-group16-sha512,diffie-hellman-group15-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha256,rsa2048-sha256,diffie-hellman-group14-sha1
DEBUG - Local Public Keys: ecdsa-sha2-nistp256,x509v3-ecdsa-sha2-nistp384,x509v3-ecdsa-sha2-nistp256,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,x509v3-ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,[email protected],[email protected],[email protected],x509v3-sign-rsa-sha1,ssh-rsa,x509v3-sign-rsa,x509v3-ssh-rsa,x509v3-rsa2048-sha256,[email protected],x509v3-ssh-dss,x509v3-sign-dss
DEBUG - Local Ciphers CS: aes256-ctr,[email protected],[email protected],[email protected],aes192-ctr,aes128-ctr,3des-ctr
DEBUG - Local Ciphers SC: aes256-ctr,[email protected],[email protected],[email protected],aes192-ctr,aes128-ctr,3des-ctr
DEBUG - Local Macs CS: [email protected],hmac-sha2-512,hmac-sha2-512,hmac-sha2-512,hmac-sha2-512-96,[email protected],hmac-sha2-256,[email protected],hmac-sha2-256,hmac-sha2-256-96,[email protected],hmac-sha1,hmac-sha1-96
DEBUG - Local Macs SC: [email protected],hmac-sha2-512,hmac-sha2-512,hmac-sha2-512,hmac-sha2-512-96,[email protected],hmac-sha2-256,[email protected],hmac-sha2-256,hmac-sha2-256-96,[email protected],hmac-sha1,hmac-sha1-96
DEBUG - Local Compression CS: none,zlib,[email protected]
DEBUG - Local Compression SC: none,zlib,[email protected]
DEBUG - Firing EVENT_KEY_EXCHANGE_INIT success=true
DEBUG - Negotiated Key Exchange: diffie-hellman-group-exchange-sha256
DEBUG - Negotiated Public Key: ecdsa-sha2-nistp256
DEBUG - Negotiated Cipher CS: aes256-ctr
DEBUG - Negotiated Cipher SC: aes256-ctr
DEBUG - Negotiated Mac CS: [email protected]
DEBUG - Negotiated Mac SC: [email protected]
DEBUG - Negotiated Compression CS: none
DEBUG - Negotiated Compression SC: none
DEBUG - Minimum DH prime size is 2048
DEBUG - Preferred DH prime size is 2048
DEBUG - Maximum DH prime size is 8192
DEBUG - Sent SSH_MSG_KEY_DH_GEX_REQUEST
DEBUG - Received 2048 bit DH prime with group 2
DEBUG - Sent SSH_MSG_KEXDH_INIT
DEBUG - Verifying server DH parameters
DEBUG - Verified DH parameters. Performing DH calculations
DEBUG - Verifying calculated DH parameters
DEBUG - Calculating exchange hash
DEBUG - Completed key exchange calculations
DEBUG - Received SSH_MSG_NEWKEYS
DEBUG - Sent SSH_MSG_NEWKEYS
DEBUG - Firing EVENT_HOSTKEY_ACCEPTED success=true
DEBUG - Firing EVENT_KEY_EXCHANGE_COMPLETE success=true
DEBUG - Sent SSH_MSG_SERVICE_REQUEST ssh-userauth
DEBUG - Starting Authentication Protocol
DEBUG - Starting none authentication
DEBUG - SSH_MSG_USERAUTH_FAILURE received auths=publickey,password,keyboard-interactive
DEBUG - none authentication failed
DEBUG - Authenticating with password
DEBUG - Adding password authentication
DEBUG - We prefer keyboard-interactive over password so injecting keyboard-interactive authenticator
DEBUG - Starting keyboard-interactive authentication
DEBUG - SSH_MSG_USERAUTH_INFO_REQUEST received
DEBUG - SSH_MSG_USERAUTH_INFO_RESPONSE sent
DEBUG - SSH_MSG_USERAUTH_INFO_REQUEST received
DEBUG - SSH_MSG_USERAUTH_INFO_RESPONSE sent
DEBUG - SSH_MSG_USERAUTH_SUCCESS received
DEBUG - Initialized MaxChannels=100
DEBUG - Stopping Authentication Protocol
DEBUG - keyboard-interactive authentication succeeded
DEBUG - Authentication succeeded
DEBUG - Sent SSH_MSG_CHANNEL_OPEN channel=0 channelType=session
DEBUG - Received SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=false
DEBUG - Received SSH_MSG_CHANNEL_OPEN_CONFIRMATION channel=0 remote=0 remotepacket=32768 remotewindow=0
DEBUG - Starting session task
DEBUG - Creating session for interactive shell
DEBUG - Sent SSH_MSG_CHANNEL_REQUEST request=pty-req wantReply=true channel=0 remote=0 localWindow=1024000 remoteWindow=0
DEBUG - Sent SSH_MSG_CHANNEL_REQUEST request=shell wantReply=true channel=0 remote=0 localWindow=1024000 remoteWindow=0
DEBUG - Received SSH_MSG_CHANNEL_SUCCESS channel=0 remote=0 localWindow=1024000 remoteWindow=0
DEBUG - Received SSH_MSG_CHANNEL_WINDOW_ADJUST channel=0 remote=0 adjust=2097152
DEBUG - Received SSH_MSG_CHANNEL_SUCCESS channel=0 remote=0 localWindow=1024000 remoteWindow=2097152
DEBUG - Received SSH_MSG_CHANNEL_DATA len=57 channel=0 remote=0 localWindow=1023943 remoteWindow=2097152
DEBUG - Received SSH_MSG_CHANNEL_DATA len=183 channel=0 remote=0 localWindow=1023760 remoteWindow=2097152
DEBUG - Received SSH_MSG_CHANNEL_DATA len=26 channel=0 remote=0 localWindow=1023734 remoteWindow=2097152
DEBUG - Performing marker test: echo "---BEGIN---" ; echo $?
DEBUG - Sent SSH_MSG_CHANNEL_DATA seq=12 len=30 channel=0 remote=0 localWindow=1023734 remoteWindow=2097122
DEBUG - Session creation complete
DEBUG - Checking state of startup controller
DEBUG - Shell still in startup mode, draining startup output
DEBUG - Shell startup (read): Last login: Sat Jun 24 11:00:53 2023 from 192.168.1.18

DEBUG - Shell startup (read):
DEBUG - Shell startup (read): The default interactive shell is now zsh.
DEBUG - Shell startup (read): To update your account to use zsh, please run chsh -s /bin/zsh.
DEBUG - Shell startup (read): For more details, please visit https://support.apple.com/kb/HT208050.
DEBUG - Received SSH_MSG_CHANNEL_DATA len=10 channel=0 remote=0 localWindow=1023724 remoteWindow=2097122
DEBUG - Received SSH_MSG_CHANNEL_DATA len=6 channel=0 remote=0 localWindow=1023718 remoteWindow=2097122
DEBUG - Received SSH_MSG_CHANNEL_DATA len=8 channel=0 remote=0 localWindow=1023710 remoteWindow=2097122
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023706 remoteWindow=2097122
DEBUG - Potentially found test marker [<machine_name>:~ akshay$ echo "---BEGIN---]
DEBUG - Detected echo of test marker command since we did not find LF at end of marker ch=34 currentLine=<machine_name>:~ akshay$ echo "---BEGIN---
DEBUG - Received SSH_MSG_CHANNEL_DATA len=2 channel=0 remote=0 localWindow=1023704 remoteWindow=2097122
DEBUG - Received SSH_MSG_CHANNEL_DATA len=16 channel=0 remote=0 localWindow=1023688 remoteWindow=2097122
DEBUG - Shell startup (read): <machine_name>:~ akshay$ echo "---BEGIN---" ; echo $?
DEBUG - Potentially found test marker [---BEGIN---]
DEBUG - Looking good, found CR
DEBUG - Found test marker
DEBUG - Detecting shell settings
DEBUG - Shell startup (detect): 0
DEBUG - This looks like a *nix type machine, setting EOL to CR only and exit code variable to $?
DEBUG - Checking state of startup controller
DEBUG - Shell is ready for command
DEBUG - Executing command: uname
DEBUG - Executing raw command: echo "---BEGIN---"; uname; echo "---END---;PROCESS=1687584933178;EXITCODE=$?"

DEBUG - Received SSH_MSG_CHANNEL_DATA len=26 channel=0 remote=0 localWindow=1023662 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=2 channel=0 remote=0 localWindow=1023660 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=26 channel=0 remote=0 localWindow=1023634 remoteWindow=2097044
DEBUG - Sent SSH_MSG_CHANNEL_DATA seq=13 len=78 channel=0 remote=0 localWindow=1023634 remoteWindow=2097044
DEBUG - uname: Expecting begin marker
DEBUG - Received SSH_MSG_CHANNEL_DATA len=9 channel=0 remote=0 localWindow=1023625 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=5 channel=0 remote=0 localWindow=1023620 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=7 channel=0 remote=0 localWindow=1023613 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023609 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023606 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023603 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023599 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023596 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023592 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023589 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023585 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023581 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023578 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023575 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023572 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023568 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023565 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023561 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023558 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023555 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=13 channel=0 remote=0 localWindow=1023542 remoteWindow=2097044
DEBUG - Received SSH_MSG_CHANNEL_DATA len=8 channel=0 remote=0 localWindow=1023534 remoteWindow=2097044
DEBUG - uname: Found begin marker
DEBUG - Received SSH_MSG_CHANNEL_DATA len=44 channel=0 remote=0 localWindow=1023490 remoteWindow=2097044
DEBUG - uname: ---END---;PROCESS=1687584933178;EXITCODE=
DEBUG - uname: Found end marker
DEBUG - uname: Looking for exit code
DEBUG - Received SSH_MSG_CHANNEL_DATA len=26 channel=0 remote=0 localWindow=1023464 remoteWindow=2097044
DEBUG - uname: Exit code is 0
DEBUG - Remote side reported it is Darwin
DEBUG - Setting default sudo prompt
DEBUG - Checking state of startup controller
DEBUG - Shell is ready for command
DEBUG - Executing command: export SUDO_PROMPT=Password:
DEBUG - Executing raw command: echo "---BEGIN---"; export SUDO_PROMPT=Password:; echo "---END---;PROCESS=1687584933190;EXITCODE=$?"

DEBUG - Sent SSH_MSG_CHANNEL_DATA seq=14 len=101 channel=0 remote=0 localWindow=1023464 remoteWindow=2096943
DEBUG - export SUDO_PROMPT=Password:: Expecting begin marker
DEBUG - Received SSH_MSG_CHANNEL_DATA len=7 channel=0 remote=0 localWindow=1023457 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=5 channel=0 remote=0 localWindow=1023452 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=7 channel=0 remote=0 localWindow=1023445 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023441 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023437 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023434 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023431 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023428 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023425 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023422 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023418 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023415 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023412 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023408 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=9 channel=0 remote=0 localWindow=1023399 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=11 channel=0 remote=0 localWindow=1023388 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023384 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023381 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023378 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023375 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023372 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023369 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023366 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023362 remoteWindow=2096943
DEBUG - Received SSH_MSG_CHANNEL_DATA len=57 channel=0 remote=0 localWindow=1023305 remoteWindow=2096943
DEBUG - export SUDO_PROMPT=Password:: Found begin marker
DEBUG - export SUDO_PROMPT=Password:: ---END---;PROCESS=1687584933190;EXITCODE=
DEBUG - export SUDO_PROMPT=Password:: Found end marker
DEBUG - export SUDO_PROMPT=Password:: Looking for exit code
DEBUG - export SUDO_PROMPT=Password:: Exit code is 0
DEBUG - Shell initialized
DEBUG - Shell is ready for command
DEBUG - Executing command: sudo launchctl unload -wF /Library/LaunchDaemons/<plist_file_path>
DEBUG - Received SSH_MSG_CHANNEL_DATA len=26 channel=0 remote=0 localWindow=1023279 remoteWindow=2096943
DEBUG - Executing raw command: echo "---BEGIN---"; sudo launchctl unload -wF /Library/LaunchDaemons/<plist_file_path>; echo "---END---;PROCESS=1687584933197;EXITCODE=$?"

DEBUG - Sent SSH_MSG_CHANNEL_DATA seq=15 len=173 channel=0 remote=0 localWindow=1023279 remoteWindow=2096770
DEBUG - sudo launchctl unload -wF /Library/LaunchDaemons/<plist_file_path>: Expecting begin marker
DEBUG - Received SSH_MSG_CHANNEL_DATA len=9 channel=0 remote=0 localWindow=1023270 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=5 channel=0 remote=0 localWindow=1023265 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=7 channel=0 remote=0 localWindow=1023258 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023255 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023251 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023248 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023244 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023241 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023238 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023235 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023231 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023228 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023225 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=2 channel=0 remote=0 localWindow=1023223 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023219 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023216 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023212 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023209 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023206 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023202 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023199 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023195 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023191 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=8 channel=0 remote=0 localWindow=1023183 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=6 channel=0 remote=0 localWindow=1023177 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023174 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023171 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023167 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023164 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023161 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023158 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023155 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023151 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023148 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023145 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023142 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023139 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023136 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023133 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023130 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023127 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023124 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=4 channel=0 remote=0 localWindow=1023120 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023117 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023114 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023111 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023108 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=3 channel=0 remote=0 localWindow=1023105 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=13 channel=0 remote=0 localWindow=1023092 remoteWindow=2096770
DEBUG - sudo launchctl unload -wF /Library/LaunchDaemons/<plist_file_path>: Found begin marker
DEBUG - Received SSH_MSG_CHANNEL_DATA len=44 channel=0 remote=0 localWindow=1023048 remoteWindow=2096770
DEBUG - Received SSH_MSG_CHANNEL_DATA len=26 channel=0 remote=0 localWindow=1023022 remoteWindow=2096770
DEBUG - sudo launchctl unload -wF /Library/LaunchDaemons/<plist_file_path>: ---END---;PROCESS=1687584933197;EXITCODE=
DEBUG - sudo launchctl unload -wF /Library/LaunchDaemons/<plist_file_path>: Found end marker
DEBUG - sudo launchctl unload -wF /Library/LaunchDaemons/<plist_file_path>: Looking for exit code
DEBUG - sudo launchctl unload -wF /Library/LaunchDaemons/<plist_file_path>: Exit code is 0
DEBUG - sudo password expression not matched
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]
DEBUG - There are 1 channels currently open
DEBUG - Sending SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Sent SSH_MSG_GLOBAL_REQUEST request=[email protected] wantReply=true
DEBUG - Received SSH_MSG_GLOBAL_REQUEST_FAILURE for [email protected]

Thread Dump
at java.lang.Object.wait(Native Method)
at com.sshtools.synergy.ssh.CachingDataWindow.waitFor(CachingDataWindow.java:159)
at com.sshtools.synergy.ssh.ChannelNG$ChannelInputStream.read(ChannelNG.java:1365)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
at com.sshtools.client.shell.ShellInputStream.read(ShellInputStream.java:145)
at com.sshtools.client.shell.ShellProcess.drain(ShellProcess.java:82)

Session Maintenance

Is there any method available for the following scenario?

Connect to SFTP Server through J2SSH Maverick implementation and upload some files.
Next time we need to upload one file. It should use the existing session and upload the file.
The session created in first step should maintain for the particular time. The next upload files should just re-use the session. If there is no upload in the particular period, the session will be closed. The next upload should connect, authenticate and reuse the session.

Support for PuTTY RSA aes256-cbc Algorithm

Hey, amazing library! I'm having trouble with RSA authentication though. I have tried two different RSA keys, both generated by the PuTTYGen tool.

The error I get when using the rsa.ppk file is as follows:

java.io.IOException: The PuTTY key could not be read! aes256-cbc is not supported [Unknown cause]
    at com.sshtools.publickey.PuTTYPrivateKeyFile.toKeyPair(PuTTYPrivateKeyFile.java:335)

Additionally (I don't know if this is related), the error I get when using the rsa file generated by PuTTYGen's OpenSSH Converter is as follows: (It's very vague.. I don't even know what the problem is)

com.sshtools.ssh.SshIOException
    at com.sshtools.publickey.PEMReader.decryptPayload(PEMReader.java:206)
    at com.sshtools.publickey.OpenSSHPrivateKeyFile.toKeyPair(OpenSSHPrivateKeyFile.java:86)

I am certain the supplied password is correct. Am I doing something wrong or is this something the library does not have support for?

Thanks

NullPointerException in ForwardingClient.SocketListener#run

The 6th line in the method "run" in the class "com.sshtools.net.ForwardingClient.SocketListener" is final Socket socket = server.accept();. The variable "server" can be null at this point which results in a NullPointerException. I recommend to change this code to ServerSocket server = this.server; if (server == null) {break;} final Socket socket = server.accept();.
I'm sorry I can't provide you a code snippet to reproduce this exception (because I can't reproduce it myself).

NPE in Ssh2Client.toString()

I ran into a NPE in Ssh2Client.toString() when I enabled logging, set an own logger with LoggerFactory.setInstance(...) and connected to a SSH server.
The NPE happened at the first two log entries where the source is a Ssh2Client.
The first log entry reads "Connecting @:22".
The second log entry reads "Remote identification is SSH-2.0-OpenSSH_7.2".
At this point the Ssh2Client's field "transport" is null which causes the NPE in toString().

Failed to process key exchange

Hello,
Greetings !!.
I am facing issue to connect to remote SSH server with your latest version 1.5.4 and previously With version 1.5.3 my code is working well but when I updated version of to 1.5.4 it started to give me error

Code Snippet:

SshConnector con = SshConnector.createInstance();
con.getContext().setHostKeyVerification(new ConsoleKnownHostsKeyVerification());
SocketTransport sc = new SocketTransport("192.168.2.19", 22);
SshClient ssh = con.connect(sc, "pratap");

I am Using below Maven Dependency.

com.sshtools j2ssh-maverick 1.5.4

Below is stack trace of Error.

com.sshtools.ssh.SshException: Failed to process key exchange [java.security.InvalidKeyException] [com.sshtools.ssh.SshException]
at com.sshtools.ssh.SshConnector.connect(SshConnector.java:322)
at com.sshtools.ssh.SshConnector.connect(SshConnector.java:169)
at com.infiverve.flint.connector.ssh2.SSH2Service.enable(SSH2Service.java:66)
at com.infiverve.flint.sdk.connectors.FlintConnectorBase.start(FlintConnectorBase.java:43)
at io.vertx.core.AbstractVerticle.start(AbstractVerticle.java:111)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$169(DeploymentManager.java:407)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$15(ContextImpl.java:314)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.sshtools.ssh.SshException: Failed to process key exchange [java.security.InvalidKeyException]
at com.sshtools.ssh.components.jce.DiffieHellmanEcdh.performClientExchange(DiffieHellmanEcdh.java:132)
at com.sshtools.ssh2.TransportProtocol.performKeyExchange(TransportProtocol.java:1165)
at com.sshtools.ssh2.TransportProtocol.processMessage(TransportProtocol.java:1541)
at com.sshtools.ssh2.TransportProtocol.startTransportProtocol(TransportProtocol.java:353)
at com.sshtools.ssh2.Ssh2Client.connect(Ssh2Client.java:140)
at com.sshtools.ssh.SshConnector.connect(SshConnector.java:316)
... 10 more
Caused by: java.security.InvalidKeyException: Not an EC key: ECDH
at sun.security.ec.ECKeyFactory.checkKey(ECKeyFactory.java:121)
at sun.security.ec.ECKeyFactory.toECKey(ECKeyFactory.java:90)
at sun.security.ec.ECDHKeyAgreement.engineInit(ECDHKeyAgreement.java:67)
at javax.crypto.KeyAgreement.implInit(KeyAgreement.java:346)
at javax.crypto.KeyAgreement.chooseProvider(KeyAgreement.java:378)
at javax.crypto.KeyAgreement.init(KeyAgreement.java:470)
at javax.crypto.KeyAgreement.init(KeyAgreement.java:441)
at com.sshtools.ssh.components.jce.DiffieHellmanEcdh.performClientExchange(DiffieHellmanEcdh.java:86)

scp pushing big files sometimes hangs forever

Hi,

I use this library to transfer files sized up to some gigabytes. Sometimes, quite rare, such a transfer doesn't complete and runs forever without any progress. Whenever i do a thread dump in this situation, the output is always as follows:

"MessagePump_Thread-1388" #1399 prio=5 os_prio=0 tid=0x00007ff3f0bf1800 nid=0x2f6b runnable [0x00007ff3d623d000]
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:170)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at java.io.DataInputStream.read(DataInputStream.java:149)
        at com.sshtools.ssh2.TransportProtocol.readWithTimeout(TransportProtocol.java:594)
        at com.sshtools.ssh2.TransportProtocol.readMessage(TransportProtocol.java:747)
        - locked <0x00000005626628d8> (a java.io.DataInputStream)
        at com.sshtools.ssh2.TransportProtocol.nextMessage(TransportProtocol.java:571)
        - locked <0x00000005626628d8> (a java.io.DataInputStream)
        at com.sshtools.ssh.message.SshMessageRouter.blockForMessage(SshMessageRouter.java:297)
        at com.sshtools.ssh.message.SshMessageRouter.access$000(SshMessageRouter.java:44)
        at com.sshtools.ssh.message.SshMessageRouter$MessagePump.run(SshMessageRouter.java:370)

   Locked ownable synchronizers:
        - None
...
"main" #1 prio=5 os_prio=0 tid=0x00007ff3f0008800 nid=0x2c70 in Object.wait() [0x00007ff3f4e26000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at com.sshtools.ssh.message.ThreadSynchronizer.requestBlock(ThreadSynchronizer.java:73)
        - locked <0x00000005626b8750> (a com.sshtools.ssh.message.ThreadSynchronizer)
        at com.sshtools.ssh.message.SshMessageRouter.nextMessage(SshMessageRouter.java:258)
        at com.sshtools.ssh.message.SshMessageStore.nextMessage(SshMessageStore.java:71)
        at com.sshtools.ssh2.Ssh2Channel.processMessages(Ssh2Channel.java:507)
        at com.sshtools.ssh2.Ssh2Channel$ChannelInputStream.read(Ssh2Channel.java:1132)
        - locked <0x00000005626b83b8> (a com.sshtools.ssh2.Ssh2Channel$ChannelInputStream)
        at com.sshtools.ssh2.Ssh2Channel$ChannelInputStream.read(Ssh2Channel.java:1097)
        at com.sshtools.scp.ScpClientIO$ScpEngineIO.waitForResponse(ScpClientIO.java:398)
        at com.sshtools.scp.ScpClient$ScpEngine.writeFileToRemote(ScpClient.java:508)
        at com.sshtools.scp.ScpClient$ScpEngine.access$000(ScpClient.java:401)
        at com.sshtools.scp.ScpClient.putFile(ScpClient.java:184)
        ...

   Locked ownable synchronizers:
        - None

A comparisson of the source and target file in this situation shows:
Somewhere in the middle of the target file, a block sized by a multiple of 4k is missing. I observed the following blocksizes: 4k, 8k, 32k. After that block, the content again matches. The target file is always a bit shorter, but not in the same way as the missing block. What i often observe: if a 32k block is missing in the middle of the file, the file is around 55k smaller. The final content of the target file does not match the final content of the source. Maybe this is due to some buffered data not yet written by the sshd?

My test file is about 260MB: $ seq -w 30000000> testfile
Using testfiles of size ~3MB or ~30MB i was not able to reproduce this problem. I need to transfer the file repeatedly for several hours to run into the problem.

Currently i was able to reproduce this problem with the following target configurations:
cygwin, OpenSSH_7.2p2, OpenSSL 1.0.2g 1 Mar 2016
cygwin, OpenSSH_7.6p1, OpenSSL 1.0.2n 7 Dec 2017
cygwin, OpenSSH_6.6.1p1, OpenSSL 1.0.1i 6 Aug 2014

On the other hand, i was not able to reproduce it on
linux, OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8, OpenSSL 1.0.1f 6 Jan 2014
linux, OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013

While it currently might looking like a cygwin problem, couldn't it be a timing/concurrency issue which only occurs due to the limited performance of cygwin?

Please let me know if (and how) i can provide more information.

This is the code i use to perform the scp put:

    public void scp(String local, String remote, String hostname, int port, String username, String keyfile, String passphrase) throws IOException {
        try {
            SshConnector con = SshConnector.createInstance();

            con.getContext().setHostKeyVerification(
                    new DisabledKnownHostsVerification());
            con.getContext().setPreferredPublicKey(Ssh2Context.PUBLIC_KEY_SSHRSA);

            try (SocketTransport t = new SocketTransport(hostname, port)) {
                t.setTcpNoDelay(true);

                Ssh2Client ssh2 = (Ssh2Client) con.connect(t, username, true);
                try {
                    PublicKeyAuthentication pk = new PublicKeyAuthentication();

                    try (FileInputStream fis = new FileInputStream(new File(System.getProperty("user.home") + File.separatorChar + ".ssh" + File.separatorChar + keyfile))) {
                        SshPrivateKeyFile pkfile = SshPrivateKeyFileFactory
                                .parse(fis);

                        SshKeyPair pair;
                        try {
                            if (pkfile.isPassphraseProtected()) {
                                if (passphrase == null) {
                                    throw new RuntimeException("private key is passphrase protected, but passphrase is missing");
                                }
                                pair = pkfile.toKeyPair(passphrase);
                            } else {
                                pair = pkfile.toKeyPair(null);
                            }
                        } catch (InvalidPassphraseException e) {
                            throw new RuntimeException("The causing exception may be due to a wrong passphrase", e);
                        }

                        pk.setPrivateKey(pair.getPrivateKey());
                        pk.setPublicKey(pair.getPublicKey());
                    }

                    if (ssh2.isConnected()) {

                        ssh2.authenticate(pk);

                        if (ssh2.isAuthenticated()) {
                            new ScpClient(ssh2).putFile(local, remote, false, null, false);
                        } else {
                            throw new RuntimeException("Authentication failed!");
                        }
                    } else {
                        throw new RuntimeException("Connection failed!");
                    }
                } finally {
                    ssh2.disconnect();
                }
            }
        } catch (SshException | ChannelOpenException e) {
            if (e.getCause() instanceof IOException) {
                throw (IOException) e.getCause();
            }
            throw new RuntimeException(e.getMessage(), e);
        }
    }

Getting error while runtime

Getting this error while running. It seams you have compiled it with JDK higher than 8. When running the jar with version 8 throws this error.

java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;|

at com.sshtools.synergy.nio.SocketConnection.processWriteEvent(SocketConnection.java:358)|

at com.sshtools.synergy.nio.SshEngine$SocketReadWriteTask.doTask(SshEngine.java:979)|

at com.sshtools.common.ssh.ConnectionAwareTask.run(ConnectionAwareTask.java:45)|

at com.sshtools.common.ssh.ExecutorOperationSupport$OperationTask.executeAllTasks(ExecutorOperationSupport.java:127)|

at com.sshtools.common.ssh.ExecutorOperationSupport$OperationTask.run(ExecutorOperationSupport.java:84)|

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)|

at java.util.concurrent.FutureTask.run(FutureTask.java:266)|

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)|

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)|

at java.lang.Thread.run(Thread.java:750)|

SFTP client to Server communication via SOCKS5 server exception

I am trying to connect to a SFTP server via SOCK5 proxy from a custom SFTP client( Java) using the maverick library. Works fine.

But when I configure the proxy server to use no authentication, I get the following error.

java.io.IOException: Invalid response from SOCKS5 server (72) localhost:1080

The socks5 proxy server used is CCproxy.

This is my code.

`SshClient ssh = null;
SshClient forwardedConnection = null;
/**
* Create an SshConnector instance
*/
SshConnector con = SshConnector.getInstance();
Ssh2Context context = (Ssh2Context) con.getContext(SshConnector.SSH2);
setupContext(context);
context.setHostKeyVerification(new ConsoleKnownHostsKeyVerification());
SocketTransport t = new SocketTransport(hostname, port);
t.setTcpNoDelay(true);
//System.out.println("t.isConnected() ->" + t.isConnected());
ssh = con.connect(t, username, true);

	PasswordAuthentication pwd = new PasswordAuthentication();
	pwd.setPassword(password);
	ssh.authenticate(pwd);
	
	
	if (ssh.isAuthenticated()) {	
		System.out.println("authenticated");
		
		// Connect via socks5 proxy
		SshTransport spt = SocksProxyTransport.connectViaSocks5Proxy(hostname, port, proxyServerHost, proxyServerPort, proxyServerUsername,proxyServerPassword);
		//SshTransport spt = HttpProxyTransport.connectViaProxy(hostname, port, proxyServerHost, proxyServerPort, proxyServerUsername, proxyServerPassword, "Maverick");
		forwardedConnection = con.connect(spt, username);
		PasswordAuthentication pwd2 = new PasswordAuthentication();
		pwd2.setPassword(password);
		forwardedConnection.authenticate(pwd2);
	}
	return forwardedConnection;
}`

Host based Connect - error java.io.IOException after requesting password for the key

trying to use j2ssh to make a SSH2 Host based Connect

and getting error

com.sshtools.ssh.SshException: java.io.IOException at com.sshtools.ssh2.Ssh2HostbasedAuthentication.authenticate(Ssh2HostbasedAuthentication.java:112) at com.sshtools.ssh2.AuthenticationProtocol.authenticate(AuthenticationProtocol.java:206) at com.sshtools.ssh2.Ssh2Client.authenticate(Ssh2Client.java:340) at shh_test.main(shh_test.java:110)

Caused by: java.io.IOException: Failed to sign data! Could not sign data at com.sshtools.ssh.components.jce.Ssh2RsaPrivateCrtKey.sign(Ssh2RsaPrivateCrtKey.java:134) at com.sshtools.ssh2.Ssh2HostbasedAuthentication.authenticate(Ssh2HostbasedAuthentication.java:99)

i basically copied the example code from SSH2HostbasedConnect.java with small modifications such as hard-coded user name and host name

error happened at step

            SshKeyPair pair;
            if (pkfile.isPassphraseProtected()) {
                System.out.print("Passphrase: ");
                pair = pkfile.toKeyPair(reader.readLine());
            } else
                pair = pkfile.toKeyPair(null);

            pk.setPrivateKey(pair.getPrivateKey());
            pk.setPublicKey(pair.getPublicKey());
        } while (ssh.authenticate(pk) != SshAuthentication.COMPLETE
                && ssh.isConnected());

I know for sure that my private key is working and I used it in tactia; and it had status - opened

what can cause it ?

maverick is failing to create the instance.

Hi Team,
I am facing java.lang.SecurityException: JCE cannot authenticate the provider BC

Caused by: java.util.jar.JarException: file:/local/apps/tomcat/webapps/remote-connect/WEB-INF/lib/TunnelProvider-1.1.0-jar-with-dependencies.jar has unsigned entries - AppBridge.properties
at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:502)
at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:363)
at javax.crypto.JarVerifier.verify(JarVerifier.java:289)
at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:164)
at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:190)
at javax.crypto.JceSecurity.getInstance(JceSecurity.java:114)
at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:270)
at com.sshtools.ssh.components.jce.DiffieHellmanGroup14Sha1.performClientExchange(DiffieHellmanGroup14Sha1.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sshtools.ssh.components.jce.JCEComponentManager.testKeyExchangeAlgorithm(JCEComponentManager.java:518)
at com.sshtools.ssh.components.jce.JCEComponentManager.initializeKeyExchangeFactory(JCEComponentManager.java:357)
at com.sshtools.ssh.components.ComponentManager.init(ComponentManager.java:155)
at com.sshtools.ssh.components.ComponentManager.getInstance(ComponentManager.java:94)
at com.sshtools.ssh2.Ssh2Context.(Ssh2Context.java:187)
at com.sshtools.ssh.SshConnector.(SshConnector.java:96)
at com.sshtools.ssh.SshConnector.createInstance(SshConnector.java:107)
at com.ge.hc.services.ffa.connectivity.common.service.SSHTunnelService.createSSHTunnel(SSHTunnelService.java:71)

The code at SSHTunnelService.java:71 to load the sshConnector

		SshConnector con = SshConnector.createInstance();
com.sshtools j2ssh-maverick 1.5.2

Please help here! Why maverick is failing to create the instance.
you early help would be much appreciated
Thank you
Krishan

SFTP upload vs download performance discrepancy

I've run into some issues recently trying to move roughly 200 files totaling about 27G over SFTP. I don't really expect the performance to match up to the native utilities, but for sake of completeness, in 100 tests of files ranging from 2MB to 2GB, the the discrepancy between the linux sftp command tool and the j2ssh-maverick test class below is about 10x on put operations and well over 80x on get operations. In the tests, both servers are reading and writing to SSD with 8GB of dedicated memory and 2 dedicated CPU. I ran the same experiment over a GigE and 40G network, both in house, with little to no load on them.

My first question is how on earth can read and write performance differ so dramatically in the opposite direction? I've tried changing the SFTPClient blockSize, bufferSize, and the tcp socket preferences, but anything less than loading the entire file into memory causes put to slow down and get to crawl.

Second, we purchased a license to the Maverick Legacy Client a few years back and, because we open sourced our project, switched over to this library. None of the above behavior occurs in the commercial product, despite the current j2ssh-maverick library being a fork of the commercial library. Is the open source library intentionally throttled in some way? That would explain the dramatic increase in failure rates we've seen since switching from the commercial version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.