第三方向我提供了身份验证信息,使我能够使用 WinSCP 登录远程服务器,并且能够自由浏览服务器、打开文件并将其复制到本地计算机。
似乎有一种方法可以在服务器内容中搜索包含文本字符串的文件(这个问题说明了);然而在我的例子中,打开了一个 PowerShell 终端,并抛出错误:
Error: Exception calling "Open" with "1" argument(s):
Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Using username "jerryjoe". Authenticating with public key "imported-openssh-key".
Authentication failed. Press any key to exit..
会话日志:
. 14:06:58.222 --------------------------------------------------------------------------
. 14:06:58.222 WinSCP Version 5.17.10 (Build 11087) (OS 10.0.19042 - Windows 10 Home)
. 14:06:58.223 Configuration: nul
. 14:06:58.223 Log level: Normal
. 14:06:58.223 Local account: LAPTOP-JUAE71NA\amine
. 14:06:58.223 Working directory: C:\Program Files (x86)\WinSCP
. 14:06:58.223 Process ID: 18736
. 14:06:58.223 Command-line: "C:\Program Files (x86)\WinSCP\winscp.exe" /xmllog="C:\Users\amine\AppData\Local\Temp\wscp310C.0088E813.tmp" /xmlgroups /xmllogrequired /nointeractiveinput /dotnet=5.17.10 /ini=nul /log="C:\Users\amine\Desktop\TEMP\lxml_gig\SeachText.log" /console /consoleinstance=_12556_46329100_455
. 14:06:58.223 Time zone: Current: GMT+1, Standard: GMT+1 (W. Europe Standard Time), DST: GMT+2 (W. Europe Daylight Time), DST Start: 28/03/2021, DST End: 31/10/2021
. 14:06:58.223 Login time: 05 February 2021 14:06:58
. 14:06:58.223 --------------------------------------------------------------------------
. 14:06:58.224 Script: Retrospectively logging previous script records:
> 14:06:58.224 Script: option batch on
< 14:06:58.224 Script: batch on
< 14:06:58.224 Script: reconnecttime 120
> 14:06:58.224 Script: option confirm off
< 14:06:58.224 Script: confirm off
> 14:06:58.224 Script: option reconnecttime 120
< 14:06:58.224 Script: reconnecttime 120
> 14:06:58.224 Script: open "sftp://[email protected]" -hostkey="ssh-ed25519-meuCVdjw0Bh-e2EIoOIkjgWuF689fALmxVA0-7zTk10" -timeout=15 -rawsettings publickeyfile="C:%5CUsers%5Camine%5CDesktop%5CTEMP%5Clxml_gig%5Cportland_highway.ppk"
. 14:06:58.224 --------------------------------------------------------------------------
. 14:06:58.224 Session name: [email protected] (Ad-Hoc site)
. 14:06:58.224 Host name: 3.90.66.14 (Port: 22)
. 14:06:58.224 User name: ec2-user (Password: No, Key file: Yes, Passphrase: No)
. 14:06:58.224 Tunnel: No
. 14:06:58.224 Transfer Protocol: SFTP
. 14:06:58.224 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 14:06:58.224 Disable Nagle: No
. 14:06:58.224 Proxy: None
. 14:06:58.224 Send buffer: 262144
. 14:06:58.224 SSH protocol version: 2; Compression: No
. 14:06:58.224 Bypass authentication: No
. 14:06:58.224 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 14:06:58.224 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 14:06:58.224 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 14:06:58.224 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 14:06:58.224 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 14:06:58.224 Simple channel: Yes
. 14:06:58.224 Return code variable: Autodetect; Lookup user groups: Auto
. 14:06:58.224 Shell: default
. 14:06:58.224 EOL: LF, UTF: Auto
. 14:06:58.224 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 14:06:58.224 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 14:06:58.224 SFTP Bugs: Auto,Auto
. 14:06:58.224 SFTP Server: default
. 14:06:58.224 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 14:06:58.224 Cache directory changes: Yes, Permanent: Yes
. 14:06:58.224 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 14:06:58.224 DST mode: Unix
. 14:06:58.224 --------------------------------------------------------------------------
. 14:06:58.224 Looking up host "3.90.66.14" for SSH connection
. 14:06:58.225 Connecting to 3.90.66.14 port 22
. 14:06:58.370 We claim version: SSH-2.0-WinSCP_release_5.17.10
. 14:06:58.542 Remote version: SSH-2.0-OpenSSH_7.4
. 14:06:58.542 Using SSH protocol version 2
. 14:06:58.542 Have a known host key of type ssh-ed25519
. 14:06:58.698 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 14:06:58.885 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
. 14:06:58.885 Host key fingerprint is:
. 14:06:58.885 ssh-ed25519 255 76:d6:7d:15:29:47:3c:9e:6f:93:53:9f:4f:21:0c:f4 meuCVdjw0Bh+e2EIoOIkjgWuF689fALmxVA0+7zTk10=
. 14:06:58.885 Host key matches configured key fingerprint
. 14:06:58.885 Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption
. 14:06:58.885 Initialised HMAC-SHA-256 outbound MAC algorithm
. 14:06:58.885 Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption
. 14:06:58.885 Initialised HMAC-SHA-256 inbound MAC algorithm
. 14:06:59.042 Reading key file "C:\Users\amine\Desktop\TEMP\lxml_gig\portland_highway.ppk"
! 14:06:59.042 Using username "ec2-user".
. 14:06:59.467 Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic
. 14:06:59.467 Offered public key
. 14:06:59.717 Offer of public key accepted
! 14:06:59.717 Authenticating with public key "imported-openssh-key"
. 14:06:59.717 Prompt (passphrase, "SSH key passphrase", <no instructions>, "Passphrase for key "imported-openssh-key": ")
. 14:06:59.717 User aborted at passphrase prompt
. 14:06:59.717 Attempt to close connection due to fatal exception:
* 14:06:59.717 **Connection has been unexpectedly closed.** Server sent command exit status 0.
. 14:06:59.717 Closing connection.
这里可能出了什么问题?我该如何解决?
答案1
WinSCP 不支持将私钥密码传递给扩展。
相反,考虑一下将您的私钥加载到Pageant。这样,它将可供 WinSCP 和扩展使用。