cant open a connection via skript
Hi,
i try to open a sftp-connection via powershell, but i get a errormessage and the skript breaks.
SFTP with the GUI ist possible without any errors.
Commands:
[Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\WinSCP\WinSCP.dll") | Out-Null
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.PortNumber = 22
$sessionOptions.Timeout = "120"
$sessionOptions.HostName = "192.168.139.17"
$sessionOptions.UserName = "xxxxxxx"
$sessionOptions.Password = "xxxxxxx"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
$session = New-Object WinSCP.Session
$session.SessionLogPath = "C:\winscp.log"
$session.Open($sessionOptions)
Powershell error:
Ausnahme beim Aufrufen von "Open" mit 1 Argument(en): "Die Verbindung wurde unerwartet geschlossen. Der Server sendete
den Befehlsbeendigungsstatus 127."
Bei Zeile:1 Zeichen:18
+ $session.Open <<<< ($sessionOptions)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Errorlog:
. 2013-10-21 21:48:34.429 --------------------------------------------------------------------------
. 2013-10-21 21:48:34.429 WinSCP Version 5.1.7 (Build 3446) (OS 6.1.7601 Service Pack 1)
. 2013-10-21 21:48:34.429 Configuration: nul
. 2013-10-21 21:48:34.429 Local account: SERVICE\Administrator
. 2013-10-21 21:48:34.429 Working directory: C:\Program Files (x86)\WinSCP
. 2013-10-21 21:48:34.429 Process ID: 2272
. 2013-10-21 21:48:34.429 Command-line: "C:\Program Files (x86)\WinSCP\winscp.exe" /xmllog="C:\Users\Administrator\AppData\Local\Temp\2\wscp0F40.039C82F0.tmp" /xmlgroups /nointeractiveinput /dotnet=517 /ini=nul /log="C:\winscp.log" /console /consoleinstance=_3904_323
. 2013-10-21 21:48:34.429 Time zone: Current: GMT+2, Standard: GMT+1, DST: GMT+2, DST Start: 31.03.2013, DST End: 27.10.2013
. 2013-10-21 21:48:34.429 Login time: Montag, 21. Oktober 2013 21:48:34
. 2013-10-21 21:48:34.429 --------------------------------------------------------------------------
. 2013-10-21 21:48:34.429 Session name: xxxxxxx@192.168.139.17 (Ad-Hoc session)
. 2013-10-21 21:48:34.429 Host name: 192.168.139.17 (Port: 22)
. 2013-10-21 21:48:34.429 User name: xxxxxxx (Password: Yes, Key file: No)
. 2013-10-21 21:48:34.429 Tunnel: No
. 2013-10-21 21:48:34.429 Transfer Protocol: SFTP
. 2013-10-21 21:48:34.429 Ping type: -, Ping interval: 30 sec; Timeout: 10368000 sec
. 2013-10-21 21:48:34.429 Proxy: none
. 2013-10-21 21:48:34.429 SSH protocol version: 2; Compression: No
. 2013-10-21 21:48:34.429 Bypass authentication: No
. 2013-10-21 21:48:34.429 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2013-10-21 21:48:34.429 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2013-10-21 21:48:34.429 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2013-10-21 21:48:34.429 Return code variable: Autodetect; Lookup user groups: A
. 2013-10-21 21:48:34.429 Shell: default
. 2013-10-21 21:48:34.429 EOL: 0, UTF: 2
. 2013-10-21 21:48:34.429 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2013-10-21 21:48:34.429 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2013-10-21 21:48:34.429 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2013-10-21 21:48:34.429 Cache directory changes: Yes, Permanent: Yes
. 2013-10-21 21:48:34.429 DST mode: 1; Timezone offset: 0h 0m
. 2013-10-21 21:48:34.429 --------------------------------------------------------------------------
. 2013-10-21 21:48:34.460 Looking up host "192.168.139.17"
. 2013-10-21 21:48:34.460 Connecting to 192.168.139.17 port 22
. 2013-10-21 21:48:34.507 Server version: SSH-2.0-OpenSSH_5.1
. 2013-10-21 21:48:34.507 Using SSH protocol version 2
. 2013-10-21 21:48:34.507 We claim version: SSH-2.0-WinSCP_release_5.1.7
. 2013-10-21 21:48:34.507 Doing Diffie-Hellman group exchange
. 2013-10-21 21:48:34.523 Doing Diffie-Hellman key exchange with hash SHA-1
. 2013-10-21 21:48:34.773 Verifying host key rsa2 0x23,.... with fingerprint ssh-rsa 2048 xx:xx...
. 2013-10-21 21:48:34.773 Host key matches configured key
. 2013-10-21 21:48:34.773 Host key fingerprint is:
. 2013-10-21 21:48:34.773 ssh-rsa 2048 xx:xx...
. 2013-10-21 21:48:34.773 Initialised AES-256 SDCTR client->server encryption
. 2013-10-21 21:48:34.773 Initialised HMAC-SHA1 client->server MAC algorithm
. 2013-10-21 21:48:34.773 Initialised AES-256 SDCTR server->client encryption
. 2013-10-21 21:48:34.773 Initialised HMAC-SHA1 server->client MAC algorithm
! 2013-10-21 21:48:34.804 Using username "xxxxxx".
. 2013-10-21 21:48:34.820 Prompt (7, SSH password, , &Passwort:)
. 2013-10-21 21:48:34.820 Using stored password.
. 2013-10-21 21:48:34.820 Sent password
. 2013-10-21 21:48:34.929 Access granted
. 2013-10-21 21:48:34.945 Opened channel for session
. 2013-10-21 21:48:34.991 Primary command failed; attempting fallback
. 2013-10-21 21:48:35.023 Started a shell/command
. 2013-10-21 21:48:35.023 --------------------------------------------------------------------------
. 2013-10-21 21:48:35.038 Using SFTP protocol.
. 2013-10-21 21:48:35.038 Doing startup conversation with host.
> 2013-10-21 21:48:35.054 Type: SSH_FXP_INIT, Size: 5, Number: -1
! 2013-10-21 21:48:35.054 bash: line 2: exec: sftp-server: not found
. 2013-10-21 21:48:35.054 Server sent command exit status 127
. 2013-10-21 21:48:35.054 Disconnected: All channels closed
i try to open a sftp-connection via powershell, but i get a errormessage and the skript breaks.
SFTP with the GUI ist possible without any errors.
Commands:
[Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\WinSCP\WinSCP.dll") | Out-Null
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.PortNumber = 22
$sessionOptions.Timeout = "120"
$sessionOptions.HostName = "192.168.139.17"
$sessionOptions.UserName = "xxxxxxx"
$sessionOptions.Password = "xxxxxxx"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
$session = New-Object WinSCP.Session
$session.SessionLogPath = "C:\winscp.log"
$session.Open($sessionOptions)
Powershell error:
Ausnahme beim Aufrufen von "Open" mit 1 Argument(en): "Die Verbindung wurde unerwartet geschlossen. Der Server sendete
den Befehlsbeendigungsstatus 127."
Bei Zeile:1 Zeichen:18
+ $session.Open <<<< ($sessionOptions)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Errorlog:
. 2013-10-21 21:48:34.429 --------------------------------------------------------------------------
. 2013-10-21 21:48:34.429 WinSCP Version 5.1.7 (Build 3446) (OS 6.1.7601 Service Pack 1)
. 2013-10-21 21:48:34.429 Configuration: nul
. 2013-10-21 21:48:34.429 Local account: SERVICE\Administrator
. 2013-10-21 21:48:34.429 Working directory: C:\Program Files (x86)\WinSCP
. 2013-10-21 21:48:34.429 Process ID: 2272
. 2013-10-21 21:48:34.429 Command-line: "C:\Program Files (x86)\WinSCP\winscp.exe" /xmllog="C:\Users\Administrator\AppData\Local\Temp\2\wscp0F40.039C82F0.tmp" /xmlgroups /nointeractiveinput /dotnet=517 /ini=nul /log="C:\winscp.log" /console /consoleinstance=_3904_323
. 2013-10-21 21:48:34.429 Time zone: Current: GMT+2, Standard: GMT+1, DST: GMT+2, DST Start: 31.03.2013, DST End: 27.10.2013
. 2013-10-21 21:48:34.429 Login time: Montag, 21. Oktober 2013 21:48:34
. 2013-10-21 21:48:34.429 --------------------------------------------------------------------------
. 2013-10-21 21:48:34.429 Session name: xxxxxxx@192.168.139.17 (Ad-Hoc session)
. 2013-10-21 21:48:34.429 Host name: 192.168.139.17 (Port: 22)
. 2013-10-21 21:48:34.429 User name: xxxxxxx (Password: Yes, Key file: No)
. 2013-10-21 21:48:34.429 Tunnel: No
. 2013-10-21 21:48:34.429 Transfer Protocol: SFTP
. 2013-10-21 21:48:34.429 Ping type: -, Ping interval: 30 sec; Timeout: 10368000 sec
. 2013-10-21 21:48:34.429 Proxy: none
. 2013-10-21 21:48:34.429 SSH protocol version: 2; Compression: No
. 2013-10-21 21:48:34.429 Bypass authentication: No
. 2013-10-21 21:48:34.429 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2013-10-21 21:48:34.429 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2013-10-21 21:48:34.429 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2013-10-21 21:48:34.429 Return code variable: Autodetect; Lookup user groups: A
. 2013-10-21 21:48:34.429 Shell: default
. 2013-10-21 21:48:34.429 EOL: 0, UTF: 2
. 2013-10-21 21:48:34.429 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2013-10-21 21:48:34.429 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2013-10-21 21:48:34.429 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2013-10-21 21:48:34.429 Cache directory changes: Yes, Permanent: Yes
. 2013-10-21 21:48:34.429 DST mode: 1; Timezone offset: 0h 0m
. 2013-10-21 21:48:34.429 --------------------------------------------------------------------------
. 2013-10-21 21:48:34.460 Looking up host "192.168.139.17"
. 2013-10-21 21:48:34.460 Connecting to 192.168.139.17 port 22
. 2013-10-21 21:48:34.507 Server version: SSH-2.0-OpenSSH_5.1
. 2013-10-21 21:48:34.507 Using SSH protocol version 2
. 2013-10-21 21:48:34.507 We claim version: SSH-2.0-WinSCP_release_5.1.7
. 2013-10-21 21:48:34.507 Doing Diffie-Hellman group exchange
. 2013-10-21 21:48:34.523 Doing Diffie-Hellman key exchange with hash SHA-1
. 2013-10-21 21:48:34.773 Verifying host key rsa2 0x23,.... with fingerprint ssh-rsa 2048 xx:xx...
. 2013-10-21 21:48:34.773 Host key matches configured key
. 2013-10-21 21:48:34.773 Host key fingerprint is:
. 2013-10-21 21:48:34.773 ssh-rsa 2048 xx:xx...
. 2013-10-21 21:48:34.773 Initialised AES-256 SDCTR client->server encryption
. 2013-10-21 21:48:34.773 Initialised HMAC-SHA1 client->server MAC algorithm
. 2013-10-21 21:48:34.773 Initialised AES-256 SDCTR server->client encryption
. 2013-10-21 21:48:34.773 Initialised HMAC-SHA1 server->client MAC algorithm
! 2013-10-21 21:48:34.804 Using username "xxxxxx".
. 2013-10-21 21:48:34.820 Prompt (7, SSH password, , &Passwort:)
. 2013-10-21 21:48:34.820 Using stored password.
. 2013-10-21 21:48:34.820 Sent password
. 2013-10-21 21:48:34.929 Access granted
. 2013-10-21 21:48:34.945 Opened channel for session
. 2013-10-21 21:48:34.991 Primary command failed; attempting fallback
. 2013-10-21 21:48:35.023 Started a shell/command
. 2013-10-21 21:48:35.023 --------------------------------------------------------------------------
. 2013-10-21 21:48:35.038 Using SFTP protocol.
. 2013-10-21 21:48:35.038 Doing startup conversation with host.
> 2013-10-21 21:48:35.054 Type: SSH_FXP_INIT, Size: 5, Number: -1
! 2013-10-21 21:48:35.054 bash: line 2: exec: sftp-server: not found
. 2013-10-21 21:48:35.054 Server sent command exit status 127
. 2013-10-21 21:48:35.054 Disconnected: All channels closed