Skip to content

Server welcome message breaks connection ("Error: Unexpected packet before version") #183

Description

@JPustkuchen

Thank you very much for this great project!

In one of our projects we experienced an issue where a connection to a clients server wasn't possible due to the hosting providers welcome motd message (see https://ownyourbits.com/2017/04/05/customize-your-motd-login-message-in-debian-and-ubuntu for example):

 if [ -f /etc/motd ];then
 	cat /etc/motd | sed "s#LOGIN#${USER##*-}#g"
 fi

This lead to connection error:

Error: Unexpected packet before version

from the gulp tool which uses ssh2-streams:
gulp-sftp
https://github.com/gtg092x/gulp-sftp/

[19:33:33] Error: Unexpected packet before version
    at SFTPStream._transform (/xx/node_modules/ssh2-streams/lib/sftp.js:306:27)
    at SFTPStream.Transform._read (internal/streams/transform.js:205:10)
    at SFTPStream._read (/xx/node_modules/ssh2-streams/lib/sftp.js:183:15)
    at SFTPStream.Transform._write (internal/streams/transform.js:193:12)
    at writeOrBuffer (internal/streams/writable.js:358:12)
    at SFTPStream.Writable.write (internal/streams/writable.js:303:10)
    at Channel.ondata (internal/streams/readable.js:726:22)
    at Channel.emit (events.js:400:28)
    at Channel.emit (domain.js:532:15)
    at Channel.Readable.read (internal/streams/readable.js:500:10)

As we can't control what hosting providers do, is there a way to handle such welcome messages before version better?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions