如何在OS X 10.6.7中打开端口22 [英] How do I open port 22 in OS X 10.6.7

查看:98
本文介绍了如何在OS X 10.6.7中打开端口22的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to open port 22 on osx so I can connect to localhost using ssh. This is my current situation:

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

我已经生成了一个密钥,并将其扔到我的authorized_keys文件中,如下所示:

I have generated a key and tossed it into my authorized_keys file like so:

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

网络实用程序"端口扫描确认22(并且令人惊讶的是23)已关闭.

A "Network Utility" port scan confirms that 22 (and surprisingly 23) are closed.

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

Context: I am working on getting Hadoop set up locally. In my configuration, I am running services on localhost:####s and need to open communications to them via ssh.

我怎么打开22?还是我要面对另一个问题(可能是密钥生成不正确?)

How can I open 22? or could I be up against another issue (improperly generated key perhaps?)

推荐答案

我认为您的端口可能是开放的,但是您没有任何监听的端口.

I think your port is probably open, but you don't have anything that listens on it.

默认情况下,Apple Mac OS X操作系统已安装SSH,但 SSH守护程序未启用.这意味着您无法远程登录或 进行远程复制,直到将其启用为止.

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.

要启用它,请转到系统偏好设置".在"Internet&联网"中有一个共享"图标.运行它.在清单中 出现,请选中远程登录"选项.在OS X Yosemite及更高版本中,不再有"Internet&联网"菜单;它已移至帐户".现在,共享"菜单在系统偏好设置"主菜单上具有其自己的图标. (谢谢@AstroCB)

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)

这将立即启动SSH守护程序,您可以远程登录 使用您的用户名. 共享"窗口的底部显示了名称 和要使用的IP地址.您也可以使用"whoami"和 终端应用程序中的"ifconfig".

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.

这些说明是从在Mac OS X中启用SSH 复制而来的,但是我想确保它们不会消失并提供快速访问.

These instructions are copied from Enable SSH in Mac OS X, but I wanted to make sure they won't go away and to provide quick access.

这篇关于如何在OS X 10.6.7中打开端口22的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆