macos 在 OS X 上将无密码 ssh 设置为本地主机

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

Setup passphraseless ssh to localhost on OS X

macossshosx-lionpassphrase

提问by Travis Nelson

I'm trying to get Hadoop's Pseudo-Distributed Operation example (http://hadoop.apache.org/common/docs/stable/single_node_setup.html) to work on OS X Lion, but am having trouble getting the ssh to work without a passphrase.

我正在尝试让 Hadoop 的伪分布式操作示例 (http://hadoop.apache.org/common/docs/stable/single_node_setup.html) 在 OS X Lion 上工作,但是在没有密码。

The instructions say the following:

说明如下:

Setup passphraseless ssh

Now check that you can ssh to the localhost without a passphrase: $ ssh localhost

设置无密码 ssh

现在检查您是否可以在没有密码的情况下通过 ssh 连接到本地主机:$ ssh localhost

I'm getting connection refused:

我的连接被拒绝:

archos:hadoop-0.20.203.0 travis$ ssh localhost
ssh: connect to host localhost port 22: Connection refused

If you cannot ssh to localhost without a passphrase, execute the following commands:

如果没有密码就无法 ssh 到 localhost,请执行以下命令:

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

After this step I am still getting connection refused. Any ideas???

在这一步之后,我仍然拒绝连接。有任何想法吗???

回答by Tyler Eaves

Sounds like you don't have SSH enabled. Should be in the network settings control panel somewhere.

听起来您没有启用 SSH。应该在网络设置控制面板的某个地方。

回答by george

You go to "System Preferences > Sharing > Remote Access" and there's a list of authorized users. Change it to "All Users".

您转到“系统偏好设置 > 共享 > 远程访问”,那里有一个授权用户列表。将其更改为“所有用户”。

That's solves this problem.

这就是解决这个问题。

回答by Herko

Check the permissions on your .ssh directory. Some ssh implementations require that the directory be chmod 700. Otherwise, they just ignore it.

检查 .ssh 目录的权限。一些 ssh 实现要求目录是 chmod 700。否则,他们只是忽略它。

Also, check the output of

另外,检查输出

ssh -v localhost

to see how the ssh client is trying to connect. The output is very detailed, and will help you decide if it's an authentication problem.

查看 ssh 客户端如何尝试连接。输出非常详细,将帮助您确定这是否是身份验证问题。

回答by vivek mishra

I had the same issue. Please check if the ssh server is running or not.

我遇到过同样的问题。请检查 ssh 服务器是否正在运行。

If yes, open the /etc/init.d/ssh_configand /etc/init.d/sshd_configfiles. The issue is that the server is running on a different port and the client is pointing to different port.

如果是,请打开/etc/init.d/ssh_config/etc/init.d/sshd_config文件。问题是服务器在不同的端口上运行,而客户端指向不同的端口。

Before this please ensure that openssh-server and client are installed.

在此之前请确保安装了 openssh-server 和 client。

回答by dakountche

I had the same problem and i solved it the following manner :

我遇到了同样的问题,我通过以下方式解决了它:

  1. SSH is activated.

  2. ssh -v localhost (as stated by Herko) In the ouput, i identified that the authentication method by DSA is not supported.

  1. SSH 已激活。

  2. ssh -v localhost(如Herko 所述)在输出中,我确定不支持 DSA 的身份验证方法。

debug1: Skipping ssh-dss key /Users/john/.ssh/id_dsa - not in PubkeyAcceptedKeyTypes

debug1:跳过 ssh-dss 密钥 /Users/john/.ssh/id_dsa - 不在 PubkeyAcceptedKeyTypes 中

  1. I simply re-generate an ECDSA keys and remove the DSA key pairs.

  2. After the keys generation, the procedure given on Hadoop documentation holds.

  1. 我只是重新生成 ECDSA 密钥并删除 DSA 密钥对。

  2. 密钥生成后,Hadoop 文档中给出的过程保持不变。

Therefore, it is important to check, if the authentication method is supported by the Openssh configuration.

因此,检查 Openssh 配置是否支持身份验证方法很重要。