Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jul 2000 21:51:28 +0200 (CEST)
From:      Paul Herman <pherman@frenchfries.net>
To:        Mark Ovens <mark@dogma.freebsd-uk.eu.org>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Question about the use of ssh-agent(1)
Message-ID:  <Pine.BSF.4.21.0007092134220.2764-100000@bagabeedaboo.security.at12.de>
In-Reply-To: <20000709195220.C233@parish>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 9 Jul 2000, Mark Ovens wrote:

> I've read the manpages for ssh-agent(1) and ssh-add(1) but require
> clarification on a couple of points.
> 
> Is adding:
> 
>    eval `ssh-agent`
>    ssh-add
> 
> to ~/.login {a,the} correct way to start it?

Looks good.  Don't forget "ssh-agent -k" in ~/.logout.

> If I login (as the same user) on more than one ttyv do I need to run
> an ssh-agent on each login?
>
> If not, should the commands in ~/.login be:
> 
>    if (! $SSH_AGENT_PID ) then
>       eval `ssh-agent`
>       ssh-add
>    fi

This would be a good idea anyway in case a login shell gets evoked
somehow from your shell (xterms do this a lot) but it won't help you
when login in on a separate ttyv.  :(

A trick way to do this would be to do something like (sorry for Bourne
notation):

  if [ "x$SSH_AGENT_PID" = "x" ]; then
   if [ -r ~/.ssh-env ]
    then eval < ~/.ssh-env
    else "eval `ssh-agent` > ~/.ssh-env"
   fi
  fi

in ~/.login, and remove ~/.ssh-env in ~/.logout.  The only problem is,
it must only be removed on the *last* logout.  This can be done, but I
don't see an easy way.  This is left as an exercise for the reader.  
:)

Short answer:  as far as I know, not so easy with multiple logins,
unless you just have multiple agents (or empty password...)

-Paul.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0007092134220.2764-100000>