Post a reply

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

toneman

Blimey!

Once I added my key to Pageant, everything was working fine and dandy. :|
toneman

WinSCP + Powershell: Disconnected: Unable to authenticate

The WinSCP GUI works fine for me. I used the code found on the site here. I've looked at the forum and can't seem to shake this "Unable to authenticate" message. IF anyone could help, I'd appreciate it! My log is below. Thanks!

It appears I authenticate successfully, but Powershell spits this out:
[b]Connection has been unexpectedly closed. Server sent command exit status 0.[/b]


[quote]$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "<HOST>"
$sessionOptions.UserName = "<USERNAME>"
$sessionOptions.Password = "<PASSWORD>"
$SessionOptions.SshPrivateKeyPath = "C:\tony-newpriv.ppk"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 b4:f7:4d:d8:39:da:9e:24:1b:2e:71:8e:e3:2b:3f:fe"[/quote]


LOG:[code]
. 2012-11-09 13:55:15.906 --------------------------------------------------------------------------
. 2012-11-09 13:55:15.906 WinSCP Version 5.1.1 (Build 2735) (OS 6.1.7601 Service Pack 1)
. 2012-11-09 13:55:15.906 Configuration: nul
. 2012-11-09 13:55:15.906 Local account: DOMAIN\USERNAME
. 2012-11-09 13:55:15.906 Working directory: C:\Users\USERNAME. 2012-11-09 13:55:15.906 Command-line: "C:\Program Files\WinSCP\winscp.exe" /xmllog="C:\Users\b888ts\AppData\Local\Temp\tmp3E96.tmp" /xmlgroups /nointeractiveinput /dotnet=511 /ini=nul /log="C:\CI-SFTP.log" /console /consoleinstance=_5628_738
. 2012-11-09 13:55:15.906 Time zone: Current: GMT-7, Standard: GMT-7, DST: GMT-6, DST Start: 3/11/2012, DST End: 11/4/2012
. 2012-11-09 13:55:15.906 Login time: Friday, November 09, 2012 1:55:15 PM
. 2012-11-09 13:55:15.906 --------------------------------------------------------------------------
. 2012-11-09 13:55:15.906 Session name: <USERNAME>@<HOST> (Ad-Hoc session)
. 2012-11-09 13:55:15.906 Host name: <HOST> (Port: 22)
. 2012-11-09 13:55:15.906 User name: <USERNAME>(Password: Yes, Key file: Yes)
. 2012-11-09 13:55:15.906 Tunnel: No
. 2012-11-09 13:55:15.906 Transfer Protocol: SFTP
. 2012-11-09 13:55:15.906 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2012-11-09 13:55:15.906 Proxy: none
. 2012-11-09 13:55:15.906 SSH protocol version: 2; Compression: No
. 2012-11-09 13:55:15.906 Bypass authentication: No
. 2012-11-09 13:55:15.906 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2012-11-09 13:55:15.906 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2012-11-09 13:55:15.906 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2012-11-09 13:55:15.906 SFTP Bugs: A,A
. 2012-11-09 13:55:15.906 Return code variable: Autodetect; Lookup user groups: A
. 2012-11-09 13:55:15.906 Shell: default
. 2012-11-09 13:55:15.906 EOL: 0, UTF: 2
. 2012-11-09 13:55:15.906 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2012-11-09 13:55:15.906 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2012-11-09 13:55:15.906 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2012-11-09 13:55:15.906 Cache directory changes: Yes, Permanent: Yes
. 2012-11-09 13:55:15.906 DST mode: 1
. 2012-11-09 13:55:15.906 --------------------------------------------------------------------------
. 2012-11-09 13:55:15.906 Looking up host "<HOST>"
. 2012-11-09 13:55:15.921 Connecting to <IP> port 22
. 2012-11-09 13:55:15.999 Server version: SSH-2.0-1.82 sshlib: sshlibSrSshServer 1.00
. 2012-11-09 13:55:15.999 Using SSH protocol version 2
. 2012-11-09 13:55:15.999 We claim version: SSH-2.0-WinSCP_release_5.1.1
. 2012-11-09 13:55:16.046 Doing Diffie-Hellman group exchange
. 2012-11-09 13:55:16.342 Doing Diffie-Hellman key exchange with hash SHA-1
. 2012-11-09 13:55:16.670 Verifying host key rsa2 0x11,0x969140df3877eb9d6a8c2c67d9b524190dd1a4e248ae7a235c105087e3ac3765ed6e41dc66296cb230cc6abcaf0e9686af83cff0ecbeee06f01957fc383ded37233ce366748a8e2fbb8b65b1c9cfa191e6beaf4e226f86f4703a753b3af3dfadf6a23ba80ce7af5fe29c637479b534120904321326ee553f7ad364bef14171983e70e09b7f4f65605e2764266105f92241e17338a0c41e1ada9d39716727b315ee839bc62440200293f1f06749fea722237825dd381ccce38d68b3e9c2708e7da157b57b0d0eaf6393e1b023f105ea5287651eda2af16c319955cb3e6a91ebef7b4d2663981b73076e12dfde3ef8d99d27b44bb4ca7a68ac9df9651b4a23da2d with fingerprint ssh-rsa 2048 b4:f7:4d:d8:39:da:9e:24:1b:2e:71:8e:e3:2b:3f:fe
. 2012-11-09 13:55:16.670 Host key matches configured key
. 2012-11-09 13:55:16.670 Host key fingerprint is:
. 2012-11-09 13:55:16.670 ssh-rsa 2048 b4:f7:4d:d8:39:da:9e:24:1b:2e:71:8e:e3:2b:3f:fe
. 2012-11-09 13:55:16.670 Initialised AES-256 CBC client->server encryption
. 2012-11-09 13:55:16.670 Initialised HMAC-SHA1 client->server MAC algorithm
. 2012-11-09 13:55:16.670 Initialised AES-256 CBC server->client encryption
. 2012-11-09 13:55:16.670 Initialised HMAC-SHA1 server->client MAC algorithm
. 2012-11-09 13:55:16.982 Reading private key file "C:\tony-newpriv.ppk"
! 2012-11-09 13:55:16.982 Using username "<USERNAME>".
. 2012-11-09 13:55:17.013 Offered public key
. 2012-11-09 13:55:17.138 Offer of public key accepted
! 2012-11-09 13:55:17.138 Authenticating with public key "imported-openssh-key"
. 2012-11-09 13:55:17.138 Prompt (3, SSH key passphrase, , Passphrase for key "imported-openssh-key": )
. 2012-11-09 13:55:17.138 Disconnected: Unable to authenticate[/code]

SERVER LOG:
[code] Session 3736/0xe98: Asking for supported authentication methods
Session 3736/0xe98: returning PUBLICKEY authentication supported
0 0 - 0 Session 3736/0xe98: Authenticating
0 0 - 0 Using "pubkey" authentication for incoming user "<USERNAME>"
0 0 - 0 Client Supplied Public Key fingerprint= 6a:7f:b8:dc:a0:3c:cb:2c:24:14:0e:a6:2a:6c:9f:69
0 0 - 0 calling DoCmdUser(<USERNAME>)
0 0 - 0 Trying to find user:<USERNAME>
<USERNAME> 0 0 - 0 Found user "<USERNAME>"
<USERNAME> 0 0 - 0 Checking to see if user "<USERNAME>" can connect from "<IP>"
<USERNAME> 0 0 - 0 User "<USERNAME>" is permitted to connect from "<IP>"
<USERNAME> 0 0 - 0 Check to see if the user's account has expired
<USERNAME> 0 0 - 0 returning 331 to request a password for this user
<USERNAME> 0 0 - 22 DoCmdUser(<USERNAME>) returned srRetCode=0, m_usLastReply=331
<USERNAME> 0 0 - 22 HostKey Folder: "D:\FTP_SecFiles\TEST\"
<USERNAME> 0 0 - 22 Loading hostkey "tony-id_rsa" for user "<USERNAME>"
<USERNAME> 0 0 - 22 Client Supplied Public Key = "AAAAB3NzaC1yc2EAAAADAQABAAABAQDFHfm3TqkY52Io7vflE5EhQJdJFkT9hE1Yf4Xzyhzee5Jy6GwXymKUUMOx2VXUiB+BY9OCjp874E/c45AwbHUM4VrdVn9Mh1uE7rX2BnG/x3pxoThOG3cjLgDPnrwMfOSjEqxKJD2HVRfyk7PX6aMG/B25zyK8B5T3DkRQ40pmE+X/yVVSezzcQxbT1QJT40v04UiU3krATpzsMpYHRtkroihuPeDk1ZNVUcD5Wr7+aa8WnGDY3n1EYiPuVLiBBzx5mvTqkGGxq7mczIX9zAEZlEAqaZh7mx4btsfryDb/yoEzQzKaele63DTYNJu6ObEPebB3OfW7TU2tBTtzvGdR"
<USERNAME> 0 0 - 22 User Public Key = "AAAAB3NzaC1yc2EAAAADAQABAAABAQCvP3h5aG0cRbXEI2vAAh0ZDW2uVcbWbvru5r7pqLY/q1bJ2nPfC7iOh9Ft/eFcHkSL5AcIpKqpmpggB9udc5C7X4tgfAFudOvNvh7xoK053BnPvjzOcZ0/Gv1L0XikZ4wIDNKrangvpUQbhHLw6ejR6YKNVg+bQvhrGO+n/tQ8lvN+hKwAQgXxezCxvGoIToKkbceuWrc7tZ+FVASB65SUZCncRTHXtK727kt0kIB72C2EKn0PJQcudmtbEszGN900G39uUIb7IWNaNY5NS5o9zu2WcS9jn1AKEcoW7F9Jjq0ab/7c0XuaI9hHkbVf6QE235l/KRT7AI8dU+zMxqQv"
<USERNAME> 0 0 - 22 Users fingerprint=[5a:6a:a2:cc:5c:85:e6:0f:e9:93:50:2c:fc:5b:73:38]
<USERNAME> 0 0 - 22 client fingerprint=[6a:7f:b8:dc:a0:3c:cb:2c:24:14:0e:a6:2a:6c:9f:69]
<USERNAME> 0 0 - 22 Loading hostkey "<USERNAME>" for user "<USERNAME>"
<USERNAME> 0 0 - 22 Client Supplied Public Key = "AAAAB3NzaC1yc2EAAAADAQABAAABAQDFHfm3TqkY52Io7vflE5EhQJdJFkT9hE1Yf4Xzyhzee5Jy6GwXymKUUMOx2VXUiB+BY9OCjp874E/c45AwbHUM4VrdVn9Mh1uE7rX2BnG/x3pxoThOG3cjLgDPnrwMfOSjEqxKJD2HVRfyk7PX6aMG/B25zyK8B5T3DkRQ40pmE+X/yVVSezzcQxbT1QJT40v04UiU3krATpzsMpYHRtkroihuPeDk1ZNVUcD5Wr7+aa8WnGDY3n1EYiPuVLiBBzx5mvTqkGGxq7mczIX9zAEZlEAqaZh7mx4btsfryDb/yoEzQzKaele63DTYNJu6ObEPebB3OfW7TU2tBTtzvGdR"
<USERNAME> 0 0 - 22 User Public Key = "AAAAB3NzaC1yc2EAAAADAQABAAABAQDFHfm3TqkY52Io7vflE5EhQJdJFkT9hE1Yf4Xzyhzee5Jy6GwXymKUUMOx2VXUiB+BY9OCjp874E/c45AwbHUM4VrdVn9Mh1uE7rX2BnG/x3pxoThOG3cjLgDPnrwMfOSjEqxKJD2HVRfyk7PX6aMG/B25zyK8B5T3DkRQ40pmE+X/yVVSezzcQxbT1QJT40v04UiU3krATpzsMpYHRtkroihuPeDk1ZNVUcD5Wr7+aa8WnGDY3n1EYiPuVLiBBzx5mvTqkGGxq7mczIX9zAEZlEAqaZh7mx4btsfryDb/yoEzQzKaele63DTYNJu6ObEPebB3OfW7TU2tBTtzvGdR"
<USERNAME> 0 0 - 22 Users fingerprint=[6a:7f:b8:dc:a0:3c:cb:2c:24:14:0e:a6:2a:6c:9f:69]
<USERNAME> 0 0 - 22 client fingerprint=[6a:7f:b8:dc:a0:3c:cb:2c:24:14:0e:a6:2a:6c:9f:69]
<USERNAME> 0 0 - 22 Authentication Success: host key matched!
<USERNAME> 0 0 - 22 Checking to see if the user account is disabled.
<USERNAME> 0 0 - 22 SFTP Public Key Authentication has authenticated user, skipping password check.
<USERNAME> 0 0 - 22 Checking to see if user "<USERNAME>" can connect from "<IP>"
<USERNAME> 0 0 - 22 User "<USERNAME>" may connect from "<IP>"
<USERNAME> 0 0 - 22 Checking secure connection settings, ConnectionIsSecure=1
<USERNAME> 0 0 - 22 Connection is SFTP connection
<USERNAME> 0 0 - 18 Verifying User Home Directory: D:\FTP_Root\TEST\HOME\<USERNAME>\
<USERNAME> 0 0 - 18 Users Home Directory attributes = GetFileAttributes("D:\FTP_Root\TEST\HOME\<USERNAME>\.")=0x00000010
- - - - - - - - fxEventMgr::AddTrigger() completed in 0ms.
<USERNAME> 0 0 - 18 User "<USERNAME>" authenticated successfully.
- - - - - - - - Session 3736/0xe98: Closed SFTP Connection from <IP>
- - - - - - - - fxEventMgr::AddTrigger() completed in 0ms.
- - - - - - - - Removing Connection from m_ConnectionList, m_ConnectionList.GetSize() is now 0, pConnectionRefCount BeforeRelease=1
- - - - - - - - Purging sessions
- - - - - - - - Purging sessions complete
- - - - - - - - Calling ClearIdleConnections() to see if there are any idle connections. 0 connections to check
- - - - - - - - no connections, leaving ClearIdleConnections()[/code]