我在 C# 程序中使用 PSCP 将文件从 Unix 机器复制到 Windows 机器时遇到问题。只有当 Windows 机器上的目标文件夹中有空格时才会出现问题。例如,以下工作正常:(注意:此示例的 IP 地址和密码已更改)
pscp.exe -pw MyPassword root@127.0.0.1:/etc/myfolder/myfile.opt C:\download
Run Code Online (Sandbox Code Playgroud)
但是当我把它改成这样时:
pscp.exe -pw MyPassword root@127.0.0.1:/etc/myfolder/myfile.opt C:\download files
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:不支持多个远程源。
我意识到这是因为 PSCP 将空间解释为另一个目标。但是我该怎么做呢?我尝试了各种方法,例如将其放在引号中并转义空格。我已经尝试了以下所有方法,但没有任何效果:
pscp.exe -pw MyPassword root@127.0.0.1:/etc/myfolder/myfile.opt "C:\download files"
pscp.exe -pw MyPassword root@127.0.0.1:/etc/myfolder/myfile.opt C:\"download files"
pscp.exe -pw MyPassword root@127.0.0.1:/etc/myfolder/myfile.opt C:\download\\ files
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我正在使用 scp 将内容复制到远程位置。但有时 scp 无法按预期工作,我发现有时复制无法正确完成(可能是当我将新文件添加到要复制的文件夹时)。
所以我想先删除远程文件夹,然后进行复制以确保我拥有我需要的东西。
是否有其他命令,如 scp(例如 srm 或 smv)?或者有没有办法删除远程文件夹和文件?
我正在尝试将 SCP 文件从一台计算机传输到另一台计算机,但是我得到了
exec 请求在通道 0 上失败”。
但是,当我使用 SSH 时,我可以毫无问题地访问机器。如果有帮助,我将在 Cygwin 中使用 SCP 功能。
我在网上搜索时发现的是“.bashrc”文件,但我发现的唯一一个是“bash.bashrc”。
这是我使用的命令:
scp /filelocation/file user@hostname:/folderlocation
Run Code Online (Sandbox Code Playgroud)
我还尝试使用 IP 地址而不是主机名,但结果相同。
我检查了远程站点是否有 SCP 命令。
我通过 scp 传输了数千个文件,每个大约 1MB,在前 2k 个文件左右之后我的连接中断了。我想知道是否有办法在不重新开始的情况下恢复递归传输。就像是
$ scp -r me@host.com:/datafiles/ ./
... Happy Transfer ...
... BREAK! ...
$ rsync -P me@host.com:/datafiles/ ./
... Continue transf...
Run Code Online (Sandbox Code Playgroud)
问题是如果可能的话,我似乎无法获得正确的语法。任何人都可以阐明是否/如何做到这一点?
附注。如果您在 rsync 行中的“datafiles”之后指定斜杠,是否会传输目录或其内容?我在谷歌搜索时看到了相互矛盾的评论。
我正在尝试使用 scp 命令将文件 (/home4/user/public_html/website.com/folder_1/folder_2/file_to_copy.zip) 从远程主机复制到本地计算机的桌面 (/Users/username/Desktop)。
为了实现这一点,我在 Mac 上运行 iTerm 并使用以下命令:
scp -r user@remotehost.com:/home4/user/public_html/website.com/folder_1/folder_2/file_to_copy.zip /Users/username/Desktop/
Run Code Online (Sandbox Code Playgroud)
(可能还值得注意的是,当我尝试执行此命令时,我通过 ssh 登录到我的远程主机。)
当我运行命令时,系统会提示我填写密码user@remotehost.com(我这样做了),然后我收到以下错误消息:
/Users/username/Desktop: 没有那个文件或目录
同样,我一直无法使用 scp 将文件复制到我的远程主机。
对这个问题的任何帮助表示高度赞赏,我希望我能得到简单/彻底的解释,因为我对使用命令行和 ssh 完全陌生。
我可以通过 ssh 进入的服务器已经开始拒绝 scp。
$ scp ~/tmp/foo user@some.example.com:~/tmp/
lost connection
Run Code Online (Sandbox Code Playgroud)
随着scp -v -v我可以看到连接成功和转移看似成功,但没有文件出现在另一边。
OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/schwern/.ssh/config
debug1: /Users/schwern/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to testcurrent01.dev.liquidweb.com [10.30.152.254] port 22.
debug1: Connection established.
debug1: identity file /Users/schwern/.ssh/id_rsa type -1
debug1: identity file /Users/schwern/.ssh/id_rsa-cert type -1
debug1: identity file /Users/schwern/.ssh/id_dsa type -1
debug1: …Run Code Online (Sandbox Code Playgroud) scp user@aws-ec2:~/file filersync --partial --progress -Pav -e ssh user@aws-ec2:~/file filescp只给我 200K/s,但rsync给我 1.9M/s
我测试了几次,结果都是一样的。
rsync 使用多线程??
我试图在我的本地服务器上使用 SCP 将文件从一个远程服务器复制到另一个远程服务器(两个远程服务器都使用自定义端口(xxxx)
我在尝试:
scp -r -P xxxx root@xxx.xxx.xxx.111:/home/myimages/images.tar.gz root@xxx.xxx.xxx.222:/home/myimages/images.tar.gz
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
ssh: connect to host xxx.xxx.xxx.222 port 22: Connection timed out
Run Code Online (Sandbox Code Playgroud)
有什么建议?
我主要来自 Windows 背景,迁移到 Mac。我使用过 WinSCP 并喜欢一个名为“保持远程目录为最新”的功能。
问题是:OSX 是否有一个等效的 SCP 客户端,可以监控目录的更改并在检测到时上传?我不在乎它是 GUI 客户端还是通过命令行(rsync、ssh 等)。
最近,我在我的家庭服务器上收到了很多这样的错误。它们的出现似乎与流量成正比,所以如果我在服务器上的 shell 中工作,我可能每天会出现 1-2 次。但是如果我启动一些 rsync 或 scp 进程,我会看到每个文件传输了 5-6 个。
kex protocol error: type 7 seq 358115
kex protocol error: type 7 seq 429489
kex protocol error: type 7 seq 500711
kex protocol error: type 7 seq 571534
kex protocol error: type 7 seq 642352
Run Code Online (Sandbox Code Playgroud)
服务器是运行OpenSSH_7.2p2, OpenSSL 1.0.2h的 Gentoo Linux 这个问题似乎发生在连接到服务器的客户端上。那可能是我的笔记本(也是带有OpenSSH_7.2p2、OpenSSL 1.0.2h 的Gentoo )或 Qnap NAS(Linux QNAP1 3.4.6 #1 SMP Wed Jun 1 05:17:33 CST 2016 x86_64 unknown - OpenSSH_7.2p2, OpenSSL 1.0 .1吨)
我一直无法找出“类型 …