ssh-agent and ssh-add on FreeBSD

Matthew Seaman m.seaman at
Mon Nov 29 22:18:39 UTC 2010

On 29/11/2010 19:08, Alexander Best wrote:
>>> [bluethundr at LBSD2:~]#ssh sum1
>>> > > Enter passphrase for key '/home/bluethundr/.ssh/id_rsa':
>>> > > [bluethundr at LBSD2:~]#exec ssh-agent bash

> ^^ this looks wrong. i think you want eval `ssh-agent` so the envars get set.
>    otherwise ssh-add won't know where to look for a running ssh-agent.

Both forms are correct.  "eval $(ssh-agent)" modifies the environment in
the current shell so ssh-add can contact ssh-agent, whereas "ssh-agent
bash" causes ssh-agent to run a copy of bash, which will it will pass
down the appropriate environmental settings to.  "exec" is just gravy,
in that it replaces the current shell with the ssh-agent process, rather
than leaving it lying around uselessly.

For the OP: no good idea why the command isn't working for you.  Try it
without the exec and also try it adding '-d' to the ssh-agent flags to
see if the debug output contains any clues.  Be sure /tmp has the
correct permissions (1777) and that the partition hasn't filled up, so
running ssh-agent can create a directory containing the unix domain
socket ssh-add uses to connect to the agent.

As for installing keychain try:

   # cd /usr/ports/security/keychain
   # make all install clean

or if you've installed it:

   # portmaster security/keychain



Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP:     Ramsgate
JID: matthew at               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url :

More information about the freebsd-questions mailing list