Linux 从远程主机到本地主机的 scp

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10838443/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:36:25  来源:igfitidea点击:

scp from remote host to local host

linuxunixscp

提问by cool_cs

I am trying to copy a file from a remote machine to the local machine I am using. Whenever I run this command I get prompted to enter a password. I am not sure what to enter for the password as I never configured any password. Anyone have any tips?

我正在尝试将文件从远程机器复制到我正在使用的本地机器上。每当我运行此命令时,都会提示我输入密码。我不确定要输入什么密码,因为我从未配置过任何密码。有人有任何提示吗?

scp stuff.php djorge@localhost:Users/djorge/Desktop

回答by 0xAX

There is must be user in AllowUsers section, in config file /etc/ssh/ssh_config, in the remote machine. You might have to restart sshd after editing the config file.

在远程计算机的配置文件 /etc/ssh/ssh_config 中的 AllowUsers 部分中必须有用户。您可能需要在编辑配置文件后重新启动 sshd。

And then you can copy for example the file "test.txt" from a remote host to the local host

然后您可以将例如文件“test.txt”从远程主机复制到本地主机

scp [email protected]:test.txt /local/dir

scp [email protected]:test.txt /local/dir



@cool_cs you can user ~ symbol ~/Users/djorge/Desktop if it's your home dir.

@cool_cs 如果它是您的主目录,您可以使用 ~ 符号 ~/Users/djorge/Desktop。

In UNIX, absolute paths must start with '/'.

在 UNIX 中,绝对路径必须以“/”开头。

回答by Snake

You need the ip of the other pc and do:

您需要另一台电脑的 ip 并执行以下操作:

scp user@ip_of_remote_pc:/home/user/stuff.php /Users/djorge/Desktop

it will ask you for 'user's password on the otherpc.

它会询问您在另一台电脑上的“用户密码” 。