Hello,

On 11:50 Fri 17 Jun     , Patrick Marquetecken wrote:
> I'm trying to setup ssh-agent because this machine must run several
> scripts with ssh on another machine and i want to use a passfrase to
> connect to this server.
> 
> So i have read the:
> http://www.gentoo.org/doc/en/keychain-guide.xml

keychain is indeed a great tool. It starts ssh-agent on its own if it 
isn't running. You don't have to start ssh-agent yourself if you're 
using keychain.

Read man keychain to learn how to install it.

For example, adding the following lines to your .bashrc  will load 2 ssh 
keys and a gpg key. If the agents are already running and the keys 
loaded, it'll show a few messages. If they aren't, it'll start the 
agents and/or load the keys and then ask your for the passwords.

keychain id_rsa id_dsa 0123ABCD
  [[ -f $HOME/.keychain/$HOSTNAME-sh ]] && \
    source $HOME/.keychain/$HOSTNAME-sh
  [[ -f $HOME/.keychain/$HOSTNAME-sh-gpg ]] && \
    source  $HOME/.keychain/$HOSTNAME-sh-gpg

> So i run ssh-agent:
> bxl-openvpn-02 .ssh # ssh-agent
> SSH_AUTH_SOCK=/tmp/ssh-bnrKl27579/agent.27579; export SSH_AUTH_SOCK;
> SSH_AGENT_PID=27580; export SSH_AGENT_PID;
> echo Agent pid 27580;
> 
> but no password ask

ssh-agent doesn't load the keys. ssh-add <file> does. But again, 
keychain does that transparently. You don't have to use the command.

> so whant to stop it with ssh-agent -k and i've got:
> bxl-openvpn-02 .ssh # ssh-agent -k
> SSH_AGENT_PID not set, cannot kill agent
> 
> so i run:
> bxl-openvpn-02 .ssh # echo $SSH_AGENT_PID
> 
> bxl-openvpn-02 .ssh #
> and indeed its empty

The output from ssh-agent has to be read by your shell. That's why 
ssh-agent is started with ssh-agent bash (or whatever shell you're 
using) when it's not started in daemon mode. Using keychain, the agents 
are running in the background and the variables are set accordingly.

-- 
Nicolas Litchinko

BOFH Excuse #38:
secretary plugged hairdryer into UPS

-- 
gentoo-user@gentoo.org mailing list

Reply via email to