LoginSignup
38
21

More than 5 years have passed since last update.

[Sierra] macos Sierra に更新してから、毎回パスフレーズを聞かれてくることに対する対策 [ssh]

Posted at

~/.ssh/config へ、次のを突っ込んでおくことが望ましいようです。

.ssh/config
Host *
   AddKeysToAgent yes
   UseKeychain yes

AddKeysToAgent

man ssh_config から

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'.

AddKeysToAgent オプションを 'yes' にすると、ssh-add 同様 ssh-agent へ、パスフレーズが登録されると、man には記述ありますが、mac osの場合、ssh-agent を使ってなく、KeyChain を使っていますので、KeyChain へ登録されます。

確認できていないのですが、Sierra の versionによっては、これが効かない場合があるようなので、最新へアップデートしてみてください。

にっちもさっちもいかない場合は、ssh-add -K <idファイル> で登録できます(´・ω・`)

UseKeychain

man ssh_config から

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 specifies 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'.

macOSの時だけ有効です。これを 'yes' にしておくと、mac の Keychain を見に行って、パスフレーズが登録されていれば、そちらを利用してくれます。

38
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
21