Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: WinSCP.SessionRemoteException: Server sent disconnect message

I have asked for logs "both from your local machine and web job".
MMR

Log file When we try to connect through winscp command prompt at WebJob Env

. 2019-06-20 21:47:40.936 --------------------------------------------------------------------------
. 2019-06-20 21:47:40.952 WinSCP Version 5.15.2 (Build 9590) (OS 10.0.14393 - Windows Server 2016 )
. 2019-06-20 21:47:40.952 Configuration: D:\home\site...........................
. 2019-06-20 21:47:40.952 Log level: Normal
. 2019-06-20 21:47:40.952 Local account: IIS APPPOOL\.................
. 2019-06-20 21:47:40.952 Working directory: D:\home\site\..........................
. 2019-06-20 21:47:40.952 Process ID: 50464
. 2019-06-20 21:47:40.952 Command-line: .\winscp.exe /console /log=log4.log /command "open username:***@hostdetail/ -hostkey=""ssh-rsa 1536 .......................""" "ls" "exit"
. 2019-06-20 21:47:40.952 --------------------------------------------------------------------------
. 2019-06-20 21:47:40.952 Script: Retrospectively logging previous script records:
> 2019-06-20 21:47:40.952 Script: open sftp://usename:***@hostdetails/ -hostkey="ssh-rsa 1536 ..........................."
. 2019-06-20 21:47:40.952 --------------------------------------------------------------------------
. 2019-06-20 21:47:40.952 Session name: username@sftpservername (Ad-Hoc site)
. 2019-06-20 21:47:40.952 Host name:sftpserername (Port: 22)
. 2019-06-20 21:47:40.952 User name: username (Password: Yes, Key file: No, Passphrase: No)
. 2019-06-20 21:47:40.952 Tunnel: No
. 2019-06-20 21:47:40.952 Transfer Protocol: SFTP
. 2019-06-20 21:47:40.952 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2019-06-20 21:47:40.952 Disable Nagle: No
. 2019-06-20 21:47:40.952 Proxy: None
. 2019-06-20 21:47:40.952 Send buffer: 262144
. 2019-06-20 21:47:40.952 SSH protocol version: 2; Compression: No
. 2019-06-20 21:47:40.952 Bypass authentication: No
. 2019-06-20 21:47:40.952 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2019-06-20 21:47:40.952 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2019-06-20 21:47:40.952 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2019-06-20 21:47:40.952 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2019-06-20 21:47:40.952 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2019-06-20 21:47:40.952 Simple channel: Yes
. 2019-06-20 21:47:40.952 Return code variable: Autodetect; Lookup user groups: Auto
. 2019-06-20 21:47:40.952 Shell: default
. 2019-06-20 21:47:40.952 EOL: LF, UTF: Auto
. 2019-06-20 21:47:40.952 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2019-06-20 21:47:40.952 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2019-06-20 21:47:40.952 SFTP Bugs: Auto,Auto
. 2019-06-20 21:47:40.952 SFTP Server: default
. 2019-06-20 21:47:40.952 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2019-06-20 21:47:40.952 Cache directory changes: Yes, Permanent: Yes
. 2019-06-20 21:47:40.952 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2019-06-20 21:47:40.952 DST mode: Unix
. 2019-06-20 21:47:40.952 --------------------------------------------------------------------------
. 2019-06-20 21:47:40.952 Looking up host "sftpservername" for SSH connection
. 2019-06-20 21:47:41.015 Connecting to ipaddress port 22
. 2019-06-20 21:47:41.046 We claim version: SSH-2.0-WinSCP_release_5.15.2
. 2019-06-20 21:47:41.093 Server version: SSH-2.0-6.3.3.81 SSH Tectia Server
. 2019-06-20 21:47:41.093 Using SSH protocol version 2
. 2019-06-20 21:47:41.108 Have a known host key of type rsa2
. 2019-06-20 21:47:41.155 Doing Diffie-Hellman group exchange
. 2019-06-20 21:47:41.218 Doing Diffie-Hellman key exchange with hash SHA-256
. 2019-06-20 21:47:42.858 Host key fingerprint is:
. 2019-06-20 21:47:42.858 ssh-rsa 1536 ...................................................
. 2019-06-20 21:47:42.858 Host key matches configured key
. 2019-06-20 21:47:42.890 Initialised AES-256 SDCTR client->server encryption
. 2019-06-20 21:47:42.890 Initialised HMAC-SHA1 client->server MAC algorithm
. 2019-06-20 21:47:42.890 Initialised AES-256 SDCTR server->client encryption
. 2019-06-20 21:47:42.890 Initialised HMAC-SHA1 server->client MAC algorithm
. 2019-06-20 21:47:43.030 Pageant is running. Requesting keys.
. 2019-06-20 21:47:43.030 Failed to get reply from Pageant
! 2019-06-20 21:47:43.030 Using username "username".
. 2019-06-20 21:47:43.077 Received disconnect message (by application)
. 2019-06-20 21:47:43.077 Disconnection message text: Access denied.
. 2019-06-20 21:47:43.077 Server sent disconnect message
. 2019-06-20 21:47:43.077 type 11 (by application):
. 2019-06-20 21:47:43.077 "Access denied."
martin

Re: WinSCP.SessionRemoteException: Server sent disconnect message

Please attach a full session log file both from your local machine and web job (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
MMR

WinSCP.SessionRemoteException: Server sent disconnect message

I am able to connect from my local machine to SFTP server but when we tried to connect from web jobs(Azure env) i am seeing below error.

We tried to connect form webjob environment, after entering the credentials it is asking to confirmation are you sure you want to connect and if we said "Y" we are able to connect.

Please see below error details:

WinSCP.SessionRemoteException: Server sent disconnect message
type 11 (by application):
"Access denied."
Authentication log (see session log for details):

Authentication failed.
at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElementAndCreateLogReader(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForGroupAndCreateLogReader()
at WinSCP.Session.WaitForGroup()
at WinSCP.Session.Open(SessionOptions sessionOptions)