gpt4 book ai didi

macos - 如何在 OS X 10.6.7 中打开端口 22

转载 作者:行者123 更新时间:2023-12-03 05:17:55 24 4
gpt4 key购买 nike

我正在尝试在 osx 上打开端口 22,以便可以使用 ssh 连接到本地主机。这是我目前的情况:

ssh localhost
ssh: connect to host localhost port 22: Connection refused

我已经生成了一个 key 并将其放入我的authorized_keys 文件中,如下所示:

sh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

“网络实用程序”端口扫描确认 22 个(令人惊讶的是 23 个)已关闭。

上下文:我正在努力在本地设置 Hadoop。在我的配置中,我在 localhost:####s 上运行服务,并且需要通过 ssh 打开与它们的通信。

如何打开22?或者我可能会遇到另一个问题(也许生成的 key 不正确?)

最佳答案

我认为您的端口可能是开放的,但您没有任何东西可以监听它。

The Apple Mac OS X operating system has SSH installed by default but the SSH daemon is not enabled. This means you can’t login remotely or do remote copies until you enable it.

To enable it, go to ‘System Preferences’. Under ‘Internet & Networking’ there is a ‘Sharing’ icon. Run that. In the list that appears, check the ‘Remote Login’ option. In OS X Yosemite and up, there is no longer an 'Internet & Networking' menu; it was moved to Accounts. The Sharing menu now has its own icon on the main System Preferences menu. (thx @AstroCB)

This starts the SSH daemon immediately and you can remotely login using your username. The ‘Sharing’ window shows at the bottom the name and IP address to use. You can also find this out using ‘whoami’ and ‘ifconfig’ from the Terminal application.

这些说明复制自 Enable SSH in Mac OS X ,但我想确保它们不会消失并提供快速访问。

关于macos - 如何在 OS X 10.6.7 中打开端口 22,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6313929/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com