If you use SSH with a private key and passphrase to log into your Unix/Linux server from a macOS Sierra terminal window, you may have noticed that it prompts for the passphrase that you had previously stored in your user’s keychain with:
after a reboot or logging out and then back in. An Internet search shows that one solution is to run:
when opening your first terminal window after you have logged into your
macOS Sierra session. I often forget, so I added the following to my bash .profile:
# Add ssh identities to ssh agent using any stored passphrase in the keychain # if they have not already been added. ssh-add -l &> /dev/null if [ $? -eq 1 ] then ssh-add -A fi
It only executes “ssh-add -A” for the first terminal window that’s opened. You can still open additional terminal windows and ssh into your server without having to enter the SSH passphrase.