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

Re: ssh setup: what is the Debian way? [not what I asked for, but OK ]



On Mon, Apr 09, 2007 at 12:01:59AM -0400, Allan Wind wrote:
> On 2007-04-08T21:24:00-0600, Paul E Condon wrote:
> > On Sat, Apr 07, 2007 at 08:26:23PM -0600, 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?
> 
<snip...>

> > So, I learned a lot about what doesn't work for me. I settled on
> > adding the following to my .bashrc:
> > 
> > if [ -x /usr/bin/ssh ] && [ -d ~/.ssh ]; then
> >    function ssh {
> >       if [ "The agent has no identities." = "$(ssh-add -L)" ]; then
> >          ssh-add
> >       fi
> >       /usr/bin/ssh $@
> >       unset -f ssh
> >    }
> > fi
> 
> You may want to ensure you have an interactive session (i.e. PS1 set),
> and check SHLVL so you do this less.
> 

You're right. There should be a check, and the standard Debian .bashrc
already contains the interactive session check.  I've placed this code
after that check. The function only gets defined for interactive
shells, and only gets executed if I attempt to run ssh.

-- 
Paul E Condon           
pecondon@mesanetworks.net



Reply to: