Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jul 2000 14:09:28 -0700
From:      "Crist J. Clark" <cristjc@earthlink.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:  <20000709140928.E394@dialin-client.earthlink.net>
In-Reply-To: <20000709195220.C233@parish>; from mark@dogma.freebsd-uk.eu.org on Sun, Jul 09, 2000 at 07:52:20PM %2B0100
References:  <20000709195220.C233@parish>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jul 09, 2000 at 07:52:20PM +0100, 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?

Does it work? :) I think that would be a legit way to start it.

> If I login (as the same user) on more than one ttyv do I need to run
> an ssh-agent on each login?

I think this work around would do it (written in sh even though you
look like you are using csh),

  if [ ! -f $HOME/.ssh-agent.sh ]; then
    UMASK=`umask`
    umask 600
    ssh-agent > $HOME/.ssh-agent.sh
    umask $UMASK
    . $HOME/.ssh-agent.sh
    ssh-add
  else
    . $HOME/.ssh-agent.sh
  fi

The only issue here is going to be that you need to clean up that file
properly when you exit. You are going to want to kill off the running
ssh-agent as well... How to tell when you are the last program using
the ssh-agent... Hmmm...

> If not, should the commands in ~/.login be:
> 
>    if (! $SSH_AGENT_PID ) then
>       eval `ssh-agent`
>       ssh-add
>    fi

Hmmm... Wouldn't that be,

  if ( ! $?SSH_AGENT_PID ) then

In csh?

Anywhoo, for my extra $0.02. I typically use ssh-agent to "parent" an
entire X session. I have the following alias,

  alias ssh-startx  ssh-agent startx

And in .xinitrc,

  if [ ! "X$SSH_AGENT_PID" = "X" ]; then
    sleep 3
    \xterm -T "SSH AUTHORIZATION" -fn '7x14' -geometry 85x5+150+250 -e ssh-add
  fi

The benefit of using the 'ssh-agent command' style is that the
ssh-agent will exit gracefully when the child process exits.
-- 
Crist J. Clark                           cjclark@alum.mit.edu


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?20000709140928.E394>