Startup Scripts for ssh-agent
I’ve just started this page to collect startup scripts for ssh-agent. It isn't complete yet.
CSH
A couple of people contributed these *csh equivilents for those using csh or its derivatives. To the .login script, add the following:
set
sshAgent=/usr/bin/ssh-agent set sshAgentArgs="-c" set
tmpFile=~/.ssh/ssh-agent-info
#
# Check for existing ssh-agent process
#
if ( -s $tmpFile ) source $tmpFile
if ( $?SSH_AGENT_PID ) then
set this=`ps -elf | grep ${SSH_AGENT_PID} | grep ssh-agent > /dev/null`
# start ssh-agent if status is nonzero
if (( $? != 0 ) && ( -x "$sshAgent" )) then
$sshAgent $sshAgentArgs | head -2 > $tmpFile
source $tmpFile
echo "ssh agent started [${SSH_AGENT_PID}]"
ssh-add
endif
endif
And, to the .logout:
if ( $?SSH_AGENT_PID ) then
echo "killing ssh agent [${SSH_AGENT_PID}]"
ssh-add -D
kill $SSH_AGENT_PID
unset SSH_AGENT_PID
unset SSH_AUTH_SOCK
endif
KDE
Note to article: http://mah.everybody.org/docs/ssh#gen-keys Adding line to .xsession when you use kdm does nothing as startkde script doesn't use it :( I created directory ~/.kde/env/ and placed there following script: #!/bin/bash eval `ssh-agent` I also created ~/.kde/shutdown directory and placed there: #!/bin/bash ssh-agent -k and it works fine :) Nice tutorial, it really helped me a lot :) Kacper Bielecki