You are not logged in.
Hi everyone, I recently encountered a strange problem with ssh-agent. For a very long I started it with a simple
ssh-agent
and everything was fine - I could add a key from a different console and everything was immediately visible in all the applications that needed SSH key authentication. However, after the last updates I noticed that simple ssh-agent no longer works - the environment variables are not exported to the system. I know I can use eval `ssh-agent`, but:
- Once I close the console, I cannot use the ssh-agent process anymore.
- The agent is not visible from a different console.
- The agent is not visible from NetBeans or something similar.
I noticed the problem for the first time in December, after switching to Arch x86_64, but I managed to get the old call working somehow. Unfortunately, I have no idea, how I did that . Now I've updated Arch x86 both on laptop and on a desktop and the problem appeared again on both of them. I found several resources about ssh-agent via Google, but nothing concerns my problem directly. Has anyone encountered a similar problem, too and knows, what is wrong with the new Arch SSH packages or how to fix it? I would appreciate any help, because SSH is critical for me and now it doesn't work correctly on any of my computers.
PozDrX, Zyx
Arch Linux PL : Arch Linux Wiki PL
Offline
I'm not sure how to directly answer your question, but here's the portion of my .bashrc I use to start the ssh agent on login. Hope it helps! I'm also running x86_64.
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
Good luck!
Scott
Offline
Unfortunately, running ssh-agent neither in .bashrc nor in .xsession solves my problem. In the first case, it runs a separate agent for each terminal I open, in the second case the ssh-agent is launched, but ssh-add does not see it. Of course, there would be no problem, if I operated from only one terminal, but I need it to log into the SVN repositories with Eclipse and NetBeans. All the resources say that ssh-agent should be run as eval `ssh-agent` or started at the beggining of the X session in order to be visible in KDE apps or similar. But then - how did it work for me for over 2 years and why it does not now?
PozDrX, Zyx
Arch Linux PL : Arch Linux Wiki PL
Offline
Hmmm... I log in without a login manager (slim,gdm, etc), so the above .bashrc is sourced at the beginning of my X session, making ssh-agent available to all applications from then on. Can you add the portions of the .bashrc above to your .xsession or create a script that autostarts when you login to X to create the SSH_ENV variable and start the ssh-agent?
Scott
Offline
OK, I've found a quite elegant solution. As I'm using KDM, the idea is to put two simple scripts into ~/.kde4/env/ and ~/.kde4/shutdown/:
#!/bin/bash
eval `ssh-agent`
#!/bin/bash
ssh-agent -k
Now the ssh agent is started during the logging in and it is visible in all the applications I'm running. In case of any problems, we can take a look at "System settings" utility in KDE4 and check in the autorun section, whether they are executed at startup or not.
Thanks for your help and some ideas .
PozDrX, Zyx
Arch Linux PL : Arch Linux Wiki PL
Offline
Here is slightly modified version, put this as ssh-agent.sh into your /etc/profile.d
SSH_ENV="$HOME/.ssh/ssh-agent.env"
function start_agent {
/usr/bin/ssh-agent |sed 's/^echo/#echo/' >"${SSH_ENV}"
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" >/dev/null
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" >/dev/null
ps -e |grep ^${SSH_AGENT_PID} |grep -q ssh-agent$ || start_agent
else
start_agent
fi
Hope that helps
Balwinder S Dheeman
http://werc.homelinux.net/
Offline