.ssh/config:“错误的配置选项:UseKeychain";在 Mac OS Sierra 10.12.6 上 [英] .ssh/config: "Bad configuration option: UseKeychain" on Mac OS Sierra 10.12.6

查看:39
本文介绍了.ssh/config:“错误的配置选项:UseKeychain";在 Mac OS Sierra 10.12.6 上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Mac(Mac OS Sierra 10.12.6)上设置我的 ssh 配置,以便将我的 ssh 密钥的密码存储在钥匙串中.以前我可以这样做

I am trying to set up my ssh config on the Mac (Mac OS Sierra 10.12.6) in such a way that it stores the passphrase for my ssh key in the keychain. Previously I could do that with

ssh-add -K ~/.ssh/id_rsa

但最近这似乎不再起作用了.在这篇文章之后,Mac OS > 10.12.2 中的 ssh 配置以及解决此问题的推荐方法是将 UseKeychain yes 添加到您的 ssh 配置中.所以这是我的 .ssh/config 部分 Host *:

But recently this doesn't seem to work anymore. Following this article there seems to be a change in the behaviour of the ssh config in Mac OS > 10.12.2 and the recommended way to fix this issue is to add UseKeychain yes to your ssh config. So here's my .ssh/config section the Host *:

Host *
  Port 22
  ServerAliveInterval 60
  ForwardAgent yes
  IdentityFile ~/.ssh/id_rsa
  AddKeysToAgent yes
  UseKeychain yes

尝试通过 ssh 连接到外部主机时,我收到以下错误消息:

When trying to ssh to a foreign host, I get the following error message:

$ ssh my-host
/Users/USER/.ssh/config: line 16: Bad configuration option: usekeychain

任何想法为什么会发生这种情况以及我如何解决它?谢谢!

Any ideas why this happens and how I can fix it? Thanks!

推荐答案

尝试指定另一个选项,即 IgnoreUnknown 如下所示:

Try to specify another option, namely IgnoreUnknown like below:

Host *
  IgnoreUnknown UseKeychain
  UseKeychain yes

您可以在此处找到有关此的更多信息.

You can find more info about this here.

如果您已经有一个 IgnoreUnknown 值,请使用逗号分隔值

If you already have an IgnoreUnknown value, use comma separated values

Host *
  IgnoreUnknown AddKeysToAgent,UseKeychain
  AddKeysToAgent yes
  UseKeychain yes

如果您有多个使用 UseKeychain 选项的 Host 配置,请确保放置

If you have multiple Host configs that use the UseKeychain option, make sure to put

Host *
  IgnoreUnknown UseKeychain

在使用该选项的第一个主机之前,例如把它放在文件的顶部.

before the first host that uses the the option, e.g. put it at the top of the file.

这篇关于.ssh/config:“错误的配置选项:UseKeychain";在 Mac OS Sierra 10.12.6 上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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