我应用了以下命令:
scp [email protected]:/Ejemlo/CLEAN.txt \Users\L\Downloads\CLEAN.txt
我收到文件已下载的通知,但该文件未出现在文件夹中。我的问题是:文件真的下载了吗?
如果已下载,我可以在哪里或如何访问该文件?
我正在使用 Windows 10 和 Cygwin64 终端进行远程连接。
注意:为安全起见,用户名和地址已更改。
我应用了以下命令:
scp [email protected]:/Ejemlo/CLEAN.txt \Users\L\Downloads\CLEAN.txt
我收到文件已下载的通知,但该文件未出现在文件夹中。我的问题是:文件真的下载了吗?
如果已下载,我可以在哪里或如何访问该文件?
我正在使用 Windows 10 和 Cygwin64 终端进行远程连接。
注意:为安全起见,用户名和地址已更改。
我有一台锁定的 Windows 11 笔记本电脑,不允许在其中安装任何第三方应用程序,例如winscp或git bash。有管理员权限的人可以做到这一点。
我需要将foo.zip文件从windows平台传输到远程ubuntu服务器。根据我浅薄的 IT 经验,我可以通过git bash 或winscp中的scp cmd 完成这样的任务。
有没有办法在没有它们的情况下将文件从 W 复制到 U ?我简要地探索了Powershell,但它似乎只适用于 W 到 W 平台,但我可能是错的。
更新
看起来PowerShell 6 或更高版本允许通过 ssh 进行远程,但不幸的是我的版本为 5。
文件
sample$1.class
sample.class
scp_test.sh
scp_test.sh
#!/bin/bash
TARGET=('sample.class' 'sample$1.class')
for dd in "${TARGET[@]}"
do
FILENAME=`basename ${dd}`
scp ${FILENAME} remote:/tmp/${dd}
done
当 shell 运行时,在远程服务器上sample$1.class
被覆盖,
只留下 .sample.class
sample.class
$ ./scp_test.sh
sample.class 100% 0 0.0KB/s 00:00
sample$1.class 100% 0 0.0KB/s 00:00
$ ssh remote 'ls -l /tmp/'
total 01
sample.class
只有当它被复制时才会发生scp
。使用本地副本的cp
行为不是这样的。
*编辑由于我使用 4.3(4.2.46) 下的 Bash 版本,我不能使用${dd@Q}
. 我通过使用引号组合'"${dd}"'
而不是 plain解决了这个问题${dd}
。
我正在使用以下命令将文件夹从远程服务器复制到本地系统,并且我在 Windows 上:
scp -r [email protected]: /var/www/projects/files/styles/image_style_150_ppi/public/misc/ C:\Users\shhu\photos
我收到以下错误:
Could not chdir to home directory /home/shhu: No such file or directory
error: unexpected filename: .
还附上了错误截图,不知道怎么办?您的帮助将不胜感激
我需要运行一个脚本,其中包含一些必须以 root 身份运行的指令和一个 scp:
sbt assembly # requires sudo
scp -r -p myfile [email protected]:/root/spark/root # doesn't require sudo
我用sudo python3 ./myscript.py
.
此外,我将 ssh 配置为myserver
使用 ssh 密钥进行通信:
Host [email protected]
PubKeyAuthentication yes
IdentityFile ~/.ssh/mykey
IdentitiesOnly=yes
PreferredAuthentications=publickey
StrictHostKeyChecking=no
我在 ssh-agent 中注册了我的 ssh 密钥,在我的 shell 启动脚本中~/.zshrc
:
eval `ssh-agent`
ssh-add ~/.ssh/kiliba
请注意,我的公钥已有效注册,myserver
并且我可以通过 ssh 或 scp 访问此服务器,这意味着我的 ssh 配置确实有效,并且我的 ssh 密钥有效。
但是,当使用 sudo 运行此脚本时,scp 一直要求我输入密码,这意味着我的 ssh 配置未使用。在我看来,为了让 scp 与 sudo 一起工作,我做了所有我需要做的事情,但我一定遗漏了一些东西。请注意,奇怪的是,虽然sudo scp
不起作用,sudo ssh
但确实有效。
有趣的细节:在另一台机器上我设法让它工作,但是我一定是在一年前完成的,我不记得我做了什么让它工作。这是一台 Mac,我目前的机器在 Ubuntu 上。
我需要配置一个脚本来将一些文件从一个 Ubuntu 服务器复制到另一个。远程服务器上的authorized_keys中允许使用密钥。
我正在尝试配置此脚本:
#!/bin/sh
#Monitoring
for i in 192.168.0.10 192.168.0.11;
do
su user1 -l -c "scp -oStrictHostKeyChecking=accept-new -oPasswordAuthentication=no -oBindAddress=0.0.0.0 -q -r /tmp/log/*log user1@${i}:/data/logs/"
done
我收到此日志:
Executing: program /usr/bin/ssh host 192.168.0.10, user user1, command scp -v -r -d -t /data/logs/
lost connection
我可以使用我在远程服务器上的帐户进行连接。但是当我尝试运行脚本时,日志是:
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 4: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.0.10 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.0.10 [192.168.0.10] port 22.
debug1: Connection established.
debug1: identity file /data/user1/.ssh/id_rsa type -1
debug1: identity file /data/user1/.ssh/id_rsa-cert type -1
debug1: identity file /data/user1/.ssh/id_dsa type -1
debug1: identity file /data/user1/.ssh/id_dsa-cert type -1
debug1: identity file /data/user1/.ssh/id_ecdsa type -1
debug1: identity file /data/user1/.ssh/id_ecdsa-cert type -1
debug1: identity file /data/user1/.ssh/id_ecdsa_sk type -1
debug1: identity file /data/user1/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /data/user1/.ssh/id_ed25519 type -1
debug1: identity file /data/user1/.ssh/id_ed25519-cert type -1
debug1: identity file /data/user1/.ssh/id_ed25519_sk type -1
debug1: identity file /data/user1/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /data/user1/.ssh/id_xmss type -1
debug1: identity file /data/user1/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.3 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.0.10:22 as 'user1'
debug3: hostkeys_foreach: reading file "/data/user1/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /data/user1/.ssh/known_hosts:7
debug3: load_hostkeys: loaded 1 keys from 192.168.0.10
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],ssh-ed25519,[email protected]
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: [email protected],diffie-hellman-group-exchange-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
debug2: ciphers stoc: [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
debug2: MACs ctos: [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,[email protected]
debug2: MACs stoc: [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,[email protected]
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
debug3: hostkeys_foreach: reading file "/data/user1/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /data/user1/.ssh/known_hosts:7
debug3: load_hostkeys: loaded 1 keys from 192.168.0.10
debug1: Host '192.168.0.10' is known and matches the RSA host key.
debug1: Found key in /data/user1/.ssh/known_hosts:7
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /data/user1/.ssh/id_rsa
debug1: Will attempt key: /data/user1/.ssh/id_dsa
debug1: Will attempt key: /data/user1/.ssh/id_ecdsa
debug1: Will attempt key: /data/user1/.ssh/id_ecdsa_sk
debug1: Will attempt key: /data/user1/.ssh/id_ed25519
debug1: Will attempt key: /data/user1/.ssh/id_ed25519_sk
debug1: Will attempt key: /data/user1/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 53
debug3: input_userauth_banner
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /data/user1/.ssh/id_rsa
debug3: sign_and_send_pubkey: RSA SHA256:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
debug3: sign_and_send_pubkey: signing using rsa-sha2-512 SHA256:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
Connection closed by 192.168.0.10 port 22
这是我可以毫无问题地访问的另一台服务器的日志:
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 4: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.0.11 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.0.11 [192.168.0.11] port 22.
debug1: Connection established.
debug1: identity file /data/user1/.ssh/id_rsa type -1
debug1: identity file /data/user1/.ssh/id_rsa-cert type -1
debug1: identity file /data/user1/.ssh/id_dsa type -1
debug1: identity file /data/user1/.ssh/id_dsa-cert type -1
debug1: identity file /data/user1/.ssh/id_ecdsa type -1
debug1: identity file /data/user1/.ssh/id_ecdsa-cert type -1
debug1: identity file /data/user1/.ssh/id_ecdsa_sk type -1
debug1: identity file /data/user1/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /data/user1/.ssh/id_ed25519 type -1
debug1: identity file /data/user1/.ssh/id_ed25519-cert type -1
debug1: identity file /data/user1/.ssh/id_ed25519_sk type -1
debug1: identity file /data/user1/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /data/user1/.ssh/id_xmss type -1
debug1: identity file /data/user1/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Debian-5+deb8u4
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u4 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.0.11:22 as 'user1'
debug3: hostkeys_foreach: reading file "/data/user1/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /data/user1/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys from 192.168.0.11
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],ssh-ed25519,[email protected]
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: [email protected],diffie-hellman-group-exchange-sha256
debug2: host key algorithms: ssh-rsa,ssh-dss
debug2: ciphers ctos: [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
debug2: ciphers stoc: [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,[email protected]
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,[email protected]
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
debug3: hostkeys_foreach: reading file "/data/user1/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /data/user1/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys from 192.168.0.11
debug1: Host '192.168.0.11' is known and matches the RSA host key.
debug1: Found key in /data/user1/.ssh/known_hosts:2
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /data/user1/.ssh/id_rsa
debug1: Will attempt key: /data/user1/.ssh/id_dsa
debug1: Will attempt key: /data/user1/.ssh/id_ecdsa
debug1: Will attempt key: /data/user1/.ssh/id_ecdsa_sk
debug1: Will attempt key: /data/user1/.ssh/id_ed25519
debug1: Will attempt key: /data/user1/.ssh/id_ed25519_sk
debug1: Will attempt key: /data/user1/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 53
debug3: input_userauth_banner
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /data/user1/.ssh/id_rsa
debug3: sign_and_send_pubkey: RSA SHA256:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
debug3: sign_and_send_pubkey: signing using ssh-rsa SHA256:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.0.11 ([192.168.0.11]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env SHELL
debug3: Ignored env PWD
debug3: Ignored env LOGNAME
debug3: Ignored env HOME
debug3: Ignored env TERM
debug3: Ignored env USER
debug3: Ignored env SHLVL
debug3: Ignored env PATH
debug3: Ignored env MAIL
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
如何解决?
我不知道 Windows 原生支持 SCP(安全副本):
例如scp "C:\somefolder\somefile" [email protected]~/somefolder/somefile
是否只有这个“客户端选项”可以将文件从 Windows 机器复制到其他系统,或者“服务器/服务选项”也可以通过 scp 复制到 Windows 机器(在 Windows 中)?
“原始”问题的一些冗长的进一步补充 (不再真正相关,但我将它们留给感兴趣的人):
仅当 Windows 不附带本机“SCP 服务器”时,任何在 Windows 中使用 3rd 方轻量级(!)重量 SCP 服务器的经验都将不胜感激。最好作为无需安装即可运行的可执行文件(便携式)并且几乎不需要设置(我知道这对于服务器应用程序来说是一个大胆的声明)。更新:有一个本地 SCP 服务器(请参阅此处,感谢 saaru获取此链接),但设置起来太“复杂”,这是一种解决方法,但仍然不是我正在寻找的解决方案。
注意 1:目标是能够将文件从 Linux 系统 scp 到 Windows 系统,并且 - 如果可能 - 无需在 Linux 机器上安装额外的软件(如 PSCP) - 如果没有本机,在 Windows 机器上安装就可以了支持。
注意 2:请不要建议您通过快速 google 搜索找到的随机 SCP 工具。我自己已经这样做了,并尝试了其中一些,但我没有遇到任何符合我要求的。请仅在您有使用它们的经验并且满足所有要求时才建议它们。
注意 3:在我(!)看来,这不是“如何从 Linux 服务器 SCP 到 Windows 客户端”的副本,原因如下:
虽然大体上相似,但它没有我的规范(SCP 可选、本机可选、简单快速设置可选)。答案也不符合我的问题要求(只有一个显示了一个本地软件的解决方案,但设置起来仍然相当“复杂”)。我承认如果没有解决方案存在但仍然是一个很好的“转到”但仍然 - 不是我问题的本质......因此,在我看来,这不是重复的帖子 - 如果你认为我错了,请发表评论 - 谢谢你。
更新:感谢Ramhound指出 Tingfeng 和 Ryan 的回答基本上与我的回答相似——它们实际上是相同的。关于“重复问题”问题,虽然它们是相同的答案,但它们不会使其成为重复问题:相同的答案可以有不同的问题。(另外,我认为这两个答案在人群中迷失了,并且没有充分关注他们的优势 - 我正在寻找的那些。事实上,这可能是问题有“重复答案”的原因)。作为关于什么构成重复的起点,我使用了这个页面,尤其是这个引用的页面。
注意:写这个问题,我假设目标主机需要有一个正在运行的 SCP 服务器,但事实并非如此,因此答案很简单(见答案)。
我从一台特定计算机(Mac OS 11.2)到一台特定主机(Ubuntu 18.04.5)出现间歇性 scp 故障。该计算机与其他主机的 scp 没有问题,其他计算机与该主机的 scp 没有问题。我对 ssh 或 mosh 也没有任何问题。
在客户端,我看到:
$ /usr/bin/scp vegan-choux-deflated-big.jpg ps:jtk/
stty: 'standard input': Inappropriate ioctl for device
vegan-choux-deflated-big.jpg 0% 0 0.0KB/s --:-- ETAclient_loop: send disconnect: Broken pipe
lost connection
在我看到的服务器上:
$ sudo journalctl -f
Feb 20 19:12:08 jefftk.com sshd[15856]: Accepted publickey for jefftk from 146.115.48.13 port 65263 ssh2: RSA SHA256:FT44f1oAdXEJtBZTFf1zxC2r6ZxptSES3ZkG/fPmYuk
Feb 20 19:12:08 jefftk.com sshd[15856]: pam_unix(sshd:session): session opened for user jefftk by (uid=0)
Feb 20 19:12:08 jefftk.com systemd-logind[3157]: New session 32 of user jefftk.
Feb 20 19:12:08 jefftk.com systemd[1]: Started Session 32 of user jefftk.
Feb 20 19:12:10 jefftk.com sshd[16050]: ssh_dispatch_run_fatal: Connection from user jefftk 146.115.48.13 port 65263: message authentication code incorrect
Feb 20 19:12:10 jefftk.com sshd[15856]: pam_unix(sshd:session): session closed for user jefftk
Feb 20 19:12:10 jefftk.com systemd-logind[3157]: Removed session 32.
好像message authentication code incorrect
是这个问题?
手动指定 MAC ( -o MACs=hmac-sha2-512
) 似乎没有效果。
此错误是间歇性的:通常一切正常。
详细上传输出:
$ /usr/bin/scp -v vegan-choux-deflated-big.jpg ps:jtk/
Executing: program /usr/bin/ssh host ps, user (unspecified), command scp -v -t jtk/
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/jefftk/.ssh/config
debug1: /Users/jefftk/.ssh/config line 25: Applying options for ps
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 74: Applying options for *
debug1: hostname canonicalisation enabled, will re-parse configuration
debug1: re-parsing configuration
debug1: Reading configuration data /Users/jefftk/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 60: Applying options for *.com
debug1: /etc/ssh/ssh_config line 64: Applying options for *.*
debug1: /etc/ssh/ssh_config line 74: Applying options for *
debug1: Connecting to www.jefftk.com [163.172.164.150] port 22.
debug1: Connection established.
debug1: identity file /Users/jefftk/.ssh/id_rsa type 0
debug1: identity file /Users/jefftk/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jefftk/.ssh/localhost/id_rsa type -1
debug1: identity file /Users/jefftk/.ssh/localhost/id_rsa-cert type -1
debug1: identity file /Users/jefftk/.ssh/clusterhost/id_rsa type -1
debug1: identity file /Users/jefftk/.ssh/clusterhost/id_rsa-cert type -1
debug1: identity file /Users/jefftk/.ssh/id_ed25519 type -1
debug1: identity file /Users/jefftk/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/jefftk/.ssh/id_ecdsa type -1
debug1: identity file /Users/jefftk/.ssh/id_ecdsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to www.jefftk.com:22 as 'jefftk'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:bXmp8R4JOzinavMiXjgpzJk7mjhNiPOQ61NChWaXrDo
debug1: Host 'www.jefftk.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/jefftk/.ssh/known_hosts:115
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: publickey ECDSA SHA256:7PPjwtPBwuO+UnzB/Myo/La/ptAQ5EI8YeDoHkpO7wM agent
debug1: Will attempt key: corp/normal ECDSA-CERT SHA256:X7GzO8/fLB5iiNYLqDU/lRz2I7CajWm8WJcKnwv0WnA agent
debug1: Will attempt key: /Users/jefftk/.ssh/id_rsa RSA SHA256:FT44f1oAdXEJtBZTFf1zxC2r6ZxptSES3ZkG/fPmYuk
debug1: Will attempt key: /Users/jefftk/.ssh/localhost/id_rsa
debug1: Will attempt key: /Users/jefftk/.ssh/clusterhost/id_rsa
debug1: Will attempt key: /Users/jefftk/.ssh/id_ed25519
debug1: Will attempt key: /Users/jefftk/.ssh/id_ecdsa
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: publickey ECDSA SHA256:7PPjwtPBwuO+UnzB/Myo/La/ptAQ5EI8YeDoHkpO7wM agent
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: corp/normal ECDSA-CERT SHA256:X7GzO8/fLB5iiNYLqDU/lRz2I7CajWm8WJcKnwv0WnA agent
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /Users/jefftk/.ssh/id_rsa RSA SHA256:FT44f1oAdXEJtBZTFf1zxC2r6ZxptSES3ZkG/fPmYuk
debug1: Server accepts key: /Users/jefftk/.ssh/id_rsa RSA SHA256:FT44f1oAdXEJtBZTFf1zxC2r6ZxptSES3ZkG/fPmYuk
debug1: Authentication succeeded (publickey).
Authenticated to www.jefftk.com ([163.172.164.150]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending command: scp -v -t jtk/
stty: 'standard input': Inappropriate ioctl for device
Sending file modes: C0644 2413695 vegan-choux-deflated-big.jpg
Sink: C0644 2413695 vegan-choux-deflated-big.jpg
vegan-choux-deflated-big.jpg 99% 2336KB 4.8MB/s 00:00 ETAclient_loop: send disconnect: Broken pipe
lost connection
我正在尝试通过排除一些常见的扩展名(如 .class .gif)来使用 WinSCP 下载具有 SCP 协议的文件夹,由于某种原因 WinSCP 忽略了我。这些文件要么仍被下载(尽管被丢弃),要么以其他方式处理,这需要时间。
我究竟做错了什么?
这是我配置下载的方式:
WinSCP 会话日志的一小部分:
> 2021-02-05 16:03:24.991 scp: error
< 2021-02-05 16:03:25.307 E
. 2021-02-05 16:03:25.307 Sending NULL.
< 2021-02-05 16:03:25.460 T1479214906 0 1612380313 0
. 2021-02-05 16:03:25.460 Sending NULL.
< 2021-02-05 16:03:25.591 C0644 5878 PrinterDetails_jsp.class
. 2021-02-05 16:03:25.591 File "/var/tomcat/tomcat001_xeroxPrinterApp/work/Catalina/xerox/xeroxPrinterApp/org/apache/jsp/WEB_002dINF/views/PrinterDetails_jsp.class" excluded from transfer
. 2021-02-05 16:03:25.591 Sending SCP error (1) to remote side:
> 2021-02-05 16:03:25.591 scp: error
< 2021-02-05 16:03:25.923 T1575667910 0 1612558660 0
. 2021-02-05 16:03:25.923 Sending NULL.
< 2021-02-05 16:03:26.060 D0755 0 plugin
. 2021-02-05 16:03:26.060 File: '/var/tomcat/tomcat001_xeroxPrinterApp/work/Catalina/xerox/xeroxPrinterApp/org/apache/jsp/WEB_002dINF/views' [2019-12-06T21:31:50.000Z] [0]
. 2021-02-05 16:03:26.060 Sending NULL.
< 2021-02-05 16:03:26.209 T1479214910 0 1575366742 0
. 2021-02-05 16:03:26.209 Sending NULL.
< 2021-02-05 16:03:26.345 C0644 8443 HeaderlessPage_jsp.java
. 2021-02-05 16:03:26.345 File: '/var/tomcat/tomcat001_xeroxPrinterApp/work/Catalina/xerox/xeroxPrinterApp/org/apache/jsp/WEB_002dINF/views/plugin' [2016-11-15T13:01:50.000Z] [8443]
. 2021-02-05 16:03:26.345 Sending NULL.
. 2021-02-05 16:03:26.345 Binary transfer mode selected.
. 2021-02-05 16:03:26.492 SCP remote side confirmation (0)
. 2021-02-05 16:03:26.492 Sending NULL.
. 2021-02-05 16:03:26.492 Preserving timestamp [2016-11-15T13:01:50.000Z]
. 2021-02-05 16:03:26.492 Transfer done: '/var/tomcat/tomcat001_xeroxPrinterApp/work/Catalina/xerox/xeroxPrinterApp/org/apache/jsp/WEB_002dINF/views/plugin/HeaderlessPage_jsp.java' => 'C:\temp\xeroxPrinterApp_UPGRADE\work\Catalina\xerox\xeroxPrinterApp\org\apache\jsp\WEB_002dINF\views\plugin\HeaderlessPage_jsp.java' [8443]
< 2021-02-05 16:03:26.645 T1479214910 0 1612380316 0
. 2021-02-05 16:03:26.645 Sending NULL.
< 2021-02-05 16:03:26.777 C0644 6876 HeaderlessPage_jsp.class
. 2021-02-05 16:03:26.777 File "/var/tomcat/tomcat001_xeroxPrinterApp/work/Catalina/xerox/xeroxPrinterApp/org/apache/jsp/WEB_002dINF/views/plugin/HeaderlessPage_jsp.class" excluded from transfer
. 2021-02-05 16:03:26.777 Sending SCP error (1) to remote side: