Linux 如何从远程机器获取文件夹到本地机器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14928382/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I get a folder from remote machine to local machine?
提问by Nilesh Agrawal
I am trying scp -r usernameipaddress:/path /pathwhereIwanttocopy
, but I am getting it as connection refused.
我正在尝试scp -r usernameipaddress:/path /pathwhereIwanttocopy
,但由于连接被拒绝,我得到了它。
How can I get it? How can I get connected?
我怎么才能得到它?如何连接?
采纳答案by Memento Mori
The -r flag should work. In your example you seem to be forgetting the name of the folder you want to copy. Try:
-r 标志应该可以工作。在您的示例中,您似乎忘记了要复制的文件夹的名称。尝试:
scp -r nameOfFolderToCopy username@ipaddress:/path/to/copy/
to copy a folder from your local computer to a remote one. Or
将文件夹从本地计算机复制到远程计算机。或者
scp -r username@ipaddress:/path/of/folder/to/copy /target/local/directory
to copy a folder from a remote machine to your local one.
将文件夹从远程机器复制到本地机器。
回答by Steve
If you have a folder called working
in your user directory, all you need is:
如果您working
的用户目录中有一个文件夹,您只需要:
scp -r username@ipaddress:working ./
It's likely you'll get "Permission Denied" with this:
很可能你会得到“权限被拒绝”:
scp -r username@ipaddress:/working ./
Can you check to see if the ssh
service is running on the remote machine? If you can login, try:
你能检查一下ssh
服务是否在远程机器上运行吗?如果可以登录,请尝试:
ps -aux | grep sshd