28

在通过 SSH 连接时尝试从远程计算机下载文件时,我不断收到错误消息。

我正在使用 Mac 并通过终端连接。

我输入以下内容:

scp username@host : /path/to/hosts/file/host_file.txt ~/desktop

然后我输入我的密码并收到以下错误:

scp: .: not a regular file
cp: cannot create regular file '/host_file.txt': permission denied
/directory/user/desktop: no such file or directory

有什么帮助吗?

它似乎正在尝试将其保存到远程系统上的目录中,但我不确定。

**更新:

我删除了 : 两侧的空间,现在似乎可以下载,但我的桌面上看不到任何内容。

感谢你的帮助。

4

2 回答 2

53

代替

scp username@host : /path/to/hosts/file/host_file.txt ~/desktop

删除:.

scp username@host:/path/to/hosts/file/host_file.txt ~/desktop

编辑:

在通过 SSH 连接时尝试从远程计算机下载文件时,我不断收到错误消息。

当您已经 sshed 到服务器时,您不应该运行 scp 命令--- 这只是将文件从服务器下载......到服务器。

您应该直接从您的 mac 运行 scp 命令。

于 2013-04-02T16:10:34.527 回答
13

去掉两边的空格:

scp username@host:/path/to/hosts/file/host_file.txt ~/desktop

(要 100% 清楚,我的意思是删除冒号字符两侧的空格)

于 2013-04-02T16:10:36.983 回答