[ Team LiB ] |
Recipe 6.11 Terminating an SSH Agent on Logout6.11.1 ProblemWhen you log out, you want the ssh-agent process to be terminated automatically. 6.11.2 SolutionFor bash: ~/.bash_profile: trap 'test -n "$SSH_AGENT_PID" && eval `/usr/bin/ssh-agent -k`' 0 ~/.logout: if ( "$SSH_AGENT_PID" != "" ) then eval `/usr/bin/ssh-agent -k` endif 6.11.3 DiscussionSSH agents you invoke yourself don't die automatically when you log out: you must kill them explicitly. When you run an agent, it defines the environment variable SSH_AGENT_PID. [Recipe 6.9] Simply test for its existence and kill the agent with the -k option. 6.11.4 See Alsossh-agent(1). |
[ Team LiB ] |