![使用 SCP 将文件从 Linux 复制到 Windows 失败,出现“权限被拒绝”错误](https://linux22.com/image/1150577/%E4%BD%BF%E7%94%A8%20SCP%20%E5%B0%86%E6%96%87%E4%BB%B6%E4%BB%8E%20Linux%20%E5%A4%8D%E5%88%B6%E5%88%B0%20Windows%20%E5%A4%B1%E8%B4%A5%EF%BC%8C%E5%87%BA%E7%8E%B0%E2%80%9C%E6%9D%83%E9%99%90%E8%A2%AB%E6%8B%92%E7%BB%9D%E2%80%9D%E9%94%99%E8%AF%AF.png)
我正在使用scp
命令将文件从 Linux 复制到 Windows。它失败并显示上述日志。
已完成的步骤:
- 安装
openssh
在 Windows 中 - 将密钥复制
id_rsa.pub
到 Linux 框中.ssh/authorized_keys
- 文件权限全部设置为完全控制
sshd_config
文件具有以下设置:RSAAuthentication yes PubkeyAuthentication yes password authentication yes
使用的命令:
scp -v /app/lib/jenkins/jobs/ChromeDriver-Version-Upgrade/jobs/ChromeDriver-Version-Upgrade/workspace/chromedriver_win32.zip/ [email protected]:/C:/
日志:
Executing: program /usr/bin/ssh host 10.1.xx.XXX, user XX_dmin, command scp -v -t /C:/
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 3: Applying options for *
debug1: Connecting to 10.1.16.149 [10.1.16.149] port 22.
debug1: Connection established.
debug1: identity file /var/lib/jenkins/.ssh/id_rsa type 1
debug1: identity file /var/lib/jenkins/.ssh/id_rsa-cert type -1
debug1: identity file /var/lib/jenkins/.ssh/id_dsa type -1
debug1: identity file /var/lib/jenkins/.ssh/id_dsa-cert type -1
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa type -1
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa-cert type -1
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519 type -1
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5
debug1: match: OpenSSH_7.5 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: kex: [email protected] need=20 dh_need=20
debug1: kex: [email protected] need=20 dh_need=20
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 96:bf:21:bb:02:ce:e8:fb:54:3f:58:40:8c:25:6b:1f
debug1: Host '10.1.XX.XXX' is known and matches the ECDSA host key.
debug1: Found key in /var/lib/jenkins/.ssh/known_hosts:36
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/lib/jenkins/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /var/lib/jenkins/.ssh/id_dsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ecdsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
lost connection
Build step 'Execute shell' marked build as failure
Finished: FAILURE