The only time the Mac OS X Terminal seems to ask for my identity file’s password, is when I restart. I’m fairly paranoid, and this seems insecure; how can I ensure it asks for the password every time I attempt to use the key?
The ssh-agent stores these for the lifetime of a session (see the ssh-agent options via 'man ssh-agent'). You can shorten the lifetime of a key added to the agent with 'ssh-agent -t 1' but the ss-agent is started by launchd at system startup. Here is a thread which describes how to deal with the problem: apple-discussion .
I would add the following configuration option to
Host * IdentitiesOnly yes
to disable the use of ssh-agent.
You can set the default (login) keychain to lock on sleep or after a timeout, which also seems to flush the SSH agent.
Or if you prefer a commandline:
security set-keychain-settings -lu -t 1 # for a 1 second timeout
I was using the org.openbsd.ssh-agent.plist change you've mentioned in the comments, but on El Cap you need to disable System Integrity Protection to do that, which I wasn't crazy about. My solution requires an extra prompt to unlock, but it's the cleanest option I've found so far.
If it's only asking you when you log in, then it's being stored in one of two places : in the ssh-agent via ssh-add or via the OSx keychain.
Personally, I'd check the Keychain first as I've a fealing it's probably a safer bet on a GUI centric machine.