Subject: Re: console scrollback ?
To: None <netbsd-users@netbsd.org>
From: Dave <spam@dberg.net>
List: netbsd-users
Date: 12/09/2004 01:17:36
On Wed, Dec 08, 2004 at 12:34:09PM -0800, Ian Main wrote:
...
> I run ssh-agent screen, fire up a few screens, do my ssh-add, and it 
> works it's magic while I'm connected to that session.  Soon as I 
> disconnect from screen and reconnect my ssh-agent isn't running anymore 
> (or at least ssh-add fails to connect to it).
> 
> There a way around this?   What I really want is to have my key 
> permanently in screen :)

  Here is a compromise/workaround I use for ssh-agent access while
under screen, and it satisfies me (but YMMV):

    Create two aliases

        ===> ~/.zshrc
        ...
        alias sagt='/usr/bin/ssh-agent | /usr/bin/tee ${HOME}/.ssh/aginf'
        alias ssagi='source ~/.ssh/aginf'
        ...

    When invoking the agent for the first time, do so via

        sagt

      instead of explicitly running ssh-agent.  Then, whenever you
      want to enable a new (or any) shell to access this agent's info,
      invoke

        ssagi

      in the new shell.

    So this will typically look something like

        ##
        # One-time setup of agent
        ##
        [ttyp3]% sagt
        [ttyp3]% ssagi
        [ttyp3]% ssh-add
        Enter passphrase for /home/dave/.ssh/id_dsa: 
        Identity added: /home/dave/.ssh/id_dsa (/home/dave/.ssh/id_dsa)
        #
        # Have fun accessing agent:
        #
        [ttyp3]% ssh-add -l
          (key fingerprint shows up)

        ##
        # One-time setup per shell (once agent is all set)
        ##
        [ttyp1]% ssagi
        [ttyp1]% ssh-add -l
          (key fingerprint shows up)

  This approach buys you extra flexibility over the vanilla ssh-agent/
subshell approach: it lets you gain access to your agent from any
shell, even one that had already been opened in a separate window
before the agent was ever started (without too much typing).  It's not
w/o limitations, though: it only supports one agent instance per user
homedir (an NFS can of worms--let me know if you fix this), and it's
not *completely* automated (an 'ssagi' is required in each new shell).
Still, it makes my life easier.

Cheers,  --Dave