Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
36
Help us understand the problem. What is going on with this article?
@d6rkaiz

macOS SierraでSSH鍵のパスフレーズの件

More than 3 years have passed since last update.

今日SierraにアップデートしたところSSHの鍵を毎回聞くようになりました。
簡単にググったところ割とトラブルになってるようですが、海外のサイトでSSHのconfigに追加すればいいという記載があり、その通りにすればできたので、備忘録がてら。

ssh_config

man ssh_config

と実行し終わり頃を見ると下記のように書いてあります。

UseKeychain
             On macOS, specifies whether the system should search for passphrases in the user's keychain when
             attempting to use a particular key. When the passphrase is provided by the user, this option also speci-
             fies whether the passphrase should be stored into the keychain once it has been verified to be correct.
             The argument must be ``yes'' or ``no''.  The default is ``no''.

追加でAddKeysToAgentも追加します。これを追加しておかないとForwardAgentが有効に動作しませんでした。

     AddKeysToAgent
             Specifies whether keys should be automatically added to a running ssh-agent(1).  If this option is set to ``yes'' and a key is loaded from
             a file, the key and its passphrase are added to the agent with the default lifetime, as if by ssh-add(1).  If this option is set to
             ``ask'', ssh will require confirmation using the SSH_ASKPASS program before adding a key (see ssh-add(1) for details).  If this option is
             set to ``confirm'', each use of the key must be confirmed, as if the -c option was specified to ssh-add(1).  If this option is set to
             ``no'', no keys are added to the agent.  The argument must be ``yes'', ``confirm'', ``ask'', or ``no''.  The default is ``no''.

defaultがnoのようなので.ssh/configに以下のように追記します。(どこでもいいと思いますが、自分は Host * に追加しました)

 Host *
   ServerAliveInterval 1200
   ServerAliveCountMax 12
   TCPKeepAlive yes
   Compression yes
+  AddKeysToAgent yes
+  UseKeychain yes
   GSSAPIAuthentication no
   UseRoaming no

参考にしたページ

http://apple.stackexchange.com/questions/254468/macos-sierra-doesn-t-seem-to-remember-ssh-keys-between-reboots

36
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
36
Help us understand the problem. What is going on with this article?