bash 无法从我的服务器 scp 到我的电脑

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

Unable to scp from my server to my computer

bashscp

提问by Léo Léopold Hertz ??

The following code does not work

以下代码不起作用

scp /home/username/public_html/site/pictures/* myUsernameAtMyMac@myIpAddress:/home/Masi/Desktop/

I have "Allow only essential services" in my Mac's firewall.

我的 Mac 防火墙中有“仅允许基本服务”。

How can you solve the problem?

你怎么能解决这个问题?

[edit]

[编辑]

I get the following error after I have "Remote Login" in the list of allowed services. I also allowed "All users".

在允许的服务列表中有“远程登录”后,我收到以下错误。我还允许“所有用户”。

scp favicon.ico [email protected]:/home/Masi/Dropbox/
ssh: connect to host 11.111.11.111 port 22: Connection timed out
lost connection

[edit]I tried to login to my computer from another Macbook unsuccessfully by the following command

[编辑]我尝试通过以下命令从另一台 Macbook 登录我的计算机失败

ssh [email protected]

I get an operation timeout error.

我收到操作超时错误。

I managed once to connect from my server to my computer with the above command, but the connection was quickly timeout.

我设法使用上述命令从我的服务器连接到我的计算机,但连接很快超时。

回答by x-way

You need to add the SSH service to the allowed applications in the firewall configuration of your Mac and change your firewall settings to “Set access for specific services and applications.”.

您需要将 SSH 服务添加到 Mac 防火墙配置中允许的应用程序,并将防火墙设置更改为“设置特定服务和应用程序的访问权限。”。

Having your firewall set to “Allow only essential services.” blocks incoming connections to services running on your machine.

将防火墙设置为“仅允许基本服务”。阻止与您机器上运行的服务的传入连接。

See also on the Apple support site: http://docs.info.apple.com/article.html?path=Mac/10.5/en/11783.html

另请参阅 Apple 支持网站:http://docs.info.apple.com/article.html? path=Mac/ 10.5/en/11783.html

回答by janneb

The scp command itself is OK.

scp 命令本身没问题。

As for your problem, impossible to say with the information given. Can you ping the machine? Try to ssh with the "-v" switch to see if you get some more relevant info about the connection procedure.

至于你的问题,根据所给的信息无法说清楚。你能ping通机器吗?尝试使用“-v”开关 ssh 以查看是否获得了有关连接过程的更多相关信息。

回答by Timo

Try this command using your mac. Should work without any firewall modifications or router settings.

使用您的 mac 试试这个命令。无需任何防火墙修改或路由器设置即可工作。

scp yourUsernameAtYourServer@YourServer:/home/username/public_html/site/pictures/* /home/Masi/Desktop/

If you are using NAT to get more then one box connected to the internet this does not work. The IP of your Mac is not visible outside your home network. In this case you have to add a port forwarding rule to yout router.

如果您使用 NAT 获得多个连接到互联网的盒子,这将不起作用。Mac 的 IP 在家庭网络之外是不可见的。在这种情况下,您必须向路由器添加端口转发规则。

myUsernameAtMyMac@myIpAddress