Previous Section  < Day Day Up >  Next Section

Recipe 17.9. Shutting Down ssh-agent Automatically at Logout

17.9.1 Problem

As a security measure, you would like to ensure that any stray ssh-agent processes are killed automatically when you log out.

17.9.2 Solution

Make this entry in your ~/.bash_logout file:

kill $SSH_AGENT_PID

17.9.3 Discussion

Don't do this if you're using keychain, because the whole point of using keychain is to be able to log in and out without having to re-enter your passphrases.

If you don't have a ~/.bash_logout file, create one. There should be a system-wide default logout file at /etc/skel/.bash_logout to use as a model.

17.9.4 See Also

  • bash(1), ssh-agent(1)

  • SSH, The Secure Shell: The Definitive Guide

    Previous Section  < Day Day Up >  Next Section