Mailing List Archive


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

[tlug] ssh-agent not being magical enough



I asked a few months back about using ssh-add to just store the key
passphrase for the lifetime of a script [1]. Thanks again for everyone's
help at that time.

What is weird is that the passphrase gets asked once after boot, then is
saved forever (i.e. nothing to do with that script). Not what I
intended, but I shrugged and accepted it.

But, now I want to do that deliberately on a remote server and it won't
work! What I want is:
  $ ssh first
  [first]$ scp abc second:~
   --> prompt for the key passphrase [2]
  [first]$ scp abc second:~
   --> used saved passphrase

This isn't what happens - it asks for the passphrase each time I use
scp. Whether I have started ssh-agent or not.

If I put this in .bash_profile on second:
  eval `ssh-agent`
  ssh-add ~/.ssh/testkey

then it saves the passphrase. But annoyingly it asks the passphrase
every time I login to "first". I don't want that, as perhaps only 10% of
my "first" ssh sessions will involve scp-ing to "second".

And I don't want to have to remember to use ssh-add manually before my
first call to scp.

Is the on-demand passphrase prompting that ubuntu/gnome is giving me
possible on a remote non-desktop server, or is this magic only available
to gnome?

TIA,

Darren

[1]:
http://darrendev.blogspot.com/2010/12/scp-with-multiple-targets-ssh-add.html


[2] I have a ~/.ssh/config file with this in it, and this part works fine:

Host second
        IdentityFile /home/darren/.ssh/testkey



-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links