From owner-freebsd-questions Sun Jul 9 14:11:44 2000 Delivered-To: freebsd-questions@freebsd.org Received: from kestrel.prod.itd.earthlink.net (kestrel.prod.itd.earthlink.net [207.217.121.155]) by hub.freebsd.org (Postfix) with ESMTP id CFDA737BF55 for ; Sun, 9 Jul 2000 14:11:40 -0700 (PDT) (envelope-from cjc@pool0264.cvx20-bradley.dialup.earthlink.net) Received: from pool0264.cvx20-bradley.dialup.earthlink.net (pool0524.cvx20-bradley.dialup.earthlink.net [209.179.252.14]) by kestrel.prod.itd.earthlink.net (8.9.3-EL_1_3/8.9.3) with ESMTP id OAA00713; Sun, 9 Jul 2000 14:11:38 -0700 (PDT) Received: (from cjc@localhost) by pool0264.cvx20-bradley.dialup.earthlink.net (8.9.3/8.9.3) id OAA00845; Sun, 9 Jul 2000 14:10:00 -0700 (PDT) Date: Sun, 9 Jul 2000 14:09:28 -0700 From: "Crist J. Clark" To: Mark Ovens Cc: questions@FreeBSD.ORG Subject: Re: Question about the use of ssh-agent(1) Message-ID: <20000709140928.E394@dialin-client.earthlink.net> Reply-To: cjclark@alum.mit.edu References: <20000709195220.C233@parish> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <20000709195220.C233@parish>; from mark@dogma.freebsd-uk.eu.org on Sun, Jul 09, 2000 at 07:52:20PM +0100 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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