Is it possible to copy a certificate to a machine running OS X Snow Leopard, add it to the System Keychain, then set it to "Always Trust via SSH?"

And if so... how?

1 Answer 1


To import a trusted certificate use the terminal command

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain <certificate>

This will add a trusted certificate to the System.keychain. You should modify the options and paths to suit your situation. See the man page for security for more information.

↬ Rich Trouton, Adding new trusted root certificates to System.keychain

  • The quotes messed me up for some reason, removed them and all was well. Apr 17, 2014 at 0:02
  • 8
    Thanks muchly! Just a note: One can also add to "$HOME/Library/Keychains/login.keychain"
    – user110537
    Jan 21, 2015 at 13:48
  • 7
    What is the difference between security add-trusted-cert and security import?
    – Nepoxx
    Oct 10, 2019 at 15:14
  • 1
    fyi to add a trusted CA to only the current user's Login keychain you don't need to sudo but you will be asked for your password: security add-trusted-cert -d -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/my-root-ca.cer
    – jamshid
    Feb 13, 2021 at 3:32
  • 2
    Does this really work from a pure terminal? security want's to do some interactions despite the sudo.
    – Martin
    Dec 14, 2021 at 15:09

You must log in to answer this question.