[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ssh setup: what is the Debian way?



On Sun, 8 Apr 2007 11:01:08 -0600, Paul E Condon
<pecondon@mesanetworks.net> said:  

> On Sun, Apr 08, 2007 at 05:50:36PM +0200, Matus UHLAR - fantomas wrote:
>> On 07.04.07 20:26, Paul E Condon wrote:
>> > Debian automagically starts ssh-agent somewhere along the chain of
>> > events that bring up X and Gnome.  I don't reboot often, but when I
>> > do, I forget to run ssh-add.  Where can I place an invocation of
>> > ssh-add so that it is run once just after login? I think there must
>> > be a Debianly correct answer. What is it?
>> 
>> I would use ~/.xsession

> Interesting idea, but

> man Xsession contains: " $HOME/.Xsession
>               is a sequence of commands invoking X clients (or a
>               session man- ager such as xsm(1x)).  

        If an example is what you want, here is mine ($default_dir is
 usually set to $HOME when I am not in a role account) :
,----[ .xsession snippet ]
| # set +x
| # would ssh-agent die at termination?
| if [ -x /usr/bin/ssh-agent ] ; then
|   if [ -z ${SSH_AGENT_PID} ] ; then
|     if test -f $default_dir/lib/.sec/ssh-agent-info && \
|       kill -0 $(cat $default_dir/lib/.sec/ssh-agent-info) 2>/dev/null; then
|         SSH_AGENT_PID=$(cat $default_dir/lib/.sec/ssh-agent.pid)
|         SSH_AUTH_SOCK=$(cat $default_dir/lib/.sec/ssh-agent.info)
|     else
|       unset SSH_AUTH_SOCK
|       unset SSH_AGENT_PID
|       rm $default_dir/lib/.sec/ssh-agent.info
|       rm $default_dir/lib/.sec/ssh-agent.pid
|       #eval $(ssh-agent -a $default_dir/var/run/agent-$$ )
|       eval $(ssh-agent)
|       echo $SSH_AGENT_PID > $default_dir/lib/.sec/ssh-agent.pid
|       echo $SSH_AUTH_SOCK > $default_dir/lib/.sec/ssh-agent.info
|     fi
|     export SSH_AUTH_SOCK
|     export SSH_AGENT_PID
|   fi
| fi
| 
| ssh-add -D
| ssh-add </dev/null 
`----

        Similar incantations work for gpg-agent and q-agent, using the
 variables GPG_AGENT_INFO and AGENT_SOCKET.

        manoj
-- 
The greatest disloyalty one can offer to great pioneers is to refuse to
move an inch from where they stood.
Manoj Srivastava <srivasta@acm.org> <http://www.golden-gryphon.com/>
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C



Reply to: