If the session manager is not used, xinitrc starts ssh-agent with the lines: # Start ssh-agent if available test -n "$sshagent" && eval `$sshagent` This works, but when xinitrc exits, ssh-agent continues to run. Subsequent invocations of xinitrc will start new ssh-agent processes, with the older ones continuing to exist, but not serving any useful purpose.
IIRC, gnome does this as well. yeah, i know, that's a crappy argument. the fix for this isn't actually that hard; i'll give it a look tonight.
fixed in CVS (after the usual anoncvs delay)
Fix confirmed. Thanks!
I seem to still suffer this problem in 4.1.91 can anyone offer me some advice?
do you have a custom ~/.config/xfce4/xinitrc left over from before the bug was fixed? if so, you'll need to copy the new one from $prefix/etc/xdg/xfce4/ and merge in any changes you had made.
the only things I have in that directory are: ls -l .config/xfce4 total 17 -rw-r--r-- 1 johnm users 70 Nov 12 00:17 Xft.xrdb -rw-r--r-- 1 johnm users 190 Nov 13 18:33 afhistory drwx------ 2 johnm users 104 Nov 13 11:49 desktop -rw-r--r-- 1 johnm users 6 Nov 17 00:14 ls-iconbox.rc drwx------ 2 johnm users 520 Nov 17 00:34 mcs_settings drwx------ 2 johnm users 112 Nov 17 00:34 panel -rw------- 1 johnm users 604 Nov 12 17:11 printsettings.xml drwx------ 2 johnm users 112 Nov 12 17:51 xfcalendar drwxr-x--- 2 johnm users 112 Nov 12 17:27 xffm drwx------ 2 johnm users 48 Nov 12 00:15 xfwm4 -- im not too sure what is actually cuasing this problem, but ssh-agent is being spawned when starting xfce4 which isnt desired :(
ah, i see. this isn't a bug about ssh-agent being started. it's about it not getting killed on quit. if you want to disable the auto start of ssh-agent, you'll need to copy $sysconfdir/xdg/xfce4/xinitrc to ~/.config/xfce4/ and edit it to remove the line that starts ssh-agent. really though, i don't see why it matters. it has rather small memory footprint and doesn't hurt anything if you don't use it. IIRC both gnome and KDE start ssh-agent in their startup script (not that that really matters).
you are correct, of course leaving it running doesnt matter. however the xinitrc file makes the assumption that there is no ssh-agent already runningfor that user id. in my case, there will already be an ssh-agent running, causing a duplicate which triggers the problem. killing it once you leave the xfce session is fine (although in my case I would still prefer it didnt do this) for example, my .bash_profile has this in it: #ssh-agent if [ -x "$(which ssh-agent)" ] ; then [ -x "$(which x11-ssh-askpass 2>/dev/null)" ] && SSH_ASKPASS="$(which x11-ssh-askpass)" [ -x "$(which gtk2-ssh-askpass 2>/dev/null)" ] && SSH_ASKPASS="$(which gtk2-ssh-askpass)" [ -z "${DISPLAY}" ] && unset SSH_ASKPASS export SSH_ASKPASS="${SSH_ASKPASS}" SSH_AGENT_PID="$(ps -C ssh-agent -o pid=)" SSH_AGENT_PID=${SSH_AGENT_PID/ /} if [ -n "${SSH_AGENT_PID}" ] ; then SSH_AUTH_SOCK=$(find /tmp -type s -iregex ".*ssh.*" -user $(id -u) 2>/dev/null) echo ">>> ssh-agent already running." echo "> active PID: ${SSH_AGENT_PID}" echo "> active SOCK: ${SSH_AUTH_SOCK}" else SSH_AUTH_SOCK="$(ssh-agent)" SSH_AGENT_PID="$(ps -C ssh-agent -o pid=)" SSH_AUTH_SOCK=${SSH_AUTH_SOCK/;*/} SSH_AUTH_SOCK=${SSH_AUTH_SOCK/*=/} echo ">>> ssh-agent launched." echo "> active PID: ${SSH_AGENT_PID}" echo "> active SOCK: ${SSH_AUTH_SOCK}" fi export SSH_AGENT_PID="${SSH_AGENT_PID}" export SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" for i in $(find ${HOME}/.ssh/ -type f -iname "id*" -not -iname "*.pub") do [ -z "$(ssh-add -l | grep ${i})" ] && sshkeys="${sshkeys} ${i}" done for i in ${sshkeys} do echo "> adding ${i}" done [ -n "${sshkeys}" ] && `ssh-add -c ${sshkeys} 2>/dev/null` echo fi although maybe not the most elegant, it serves the purpose. could we not do this in the xfce xinitrc as well (since I found out I can copy the xfce btw its worked fine :) thanks) and if we found that we didnt launch ssh-agent, then we shouldn't kill it when we leave the session. we should only kill it if xfce was the thing that spawned it. I also have a very similar thing for gpg-agent, which perhaps you might consider adding to xfce4 xinitrc also. the code for that is: #gpg-agent if [ -x "$(which gpg-agent)" ] ; then GPG_AGENT_PID="$(ps -C gpg-agent -o pid=)" GPG_AGENT_PID=${GPG_AGENT_PID/ /} if [ -n "${GPG_AGENT_PID}" ] ; then GPG_AGENT_INFO=$(find /tmp -type s -iregex ".*gpg.*" -user $(id -u) 2>/dev/null) GPG_AGENT_INFO="${GPG_AGENT_INFO}:${GPG_AGENT_PID}:1" echo ">>> gpg-agent already running." echo "> active PID: ${GPG_AGENT_PID}" echo "> active INFO: ${GPG_AGENT_INFO}" else GPG_AGENT_INFO=$(gpg-agent --daemon) GPG_AGENT_INFO=${GPG_AGENT_INFO/;*/} GPG_AGENT_PID=${GPG_AGENT_INFO/*gent:/} GPG_AGENT_PID=${GPG_AGENT_PID/:*/} echo ">>> gpg-agent launched." echo "> active PID: ${GPG_AGENT_PID}" echo "> active INFO: ${GPG_AGENT_INFO}" fi export GPG_AGENT_PID="${GPG_AGENT_PID}" export GPG_AGENT_INFO="${GPG_AGENT_INFO}" echo fi regards.
i don't really want to put that much into xinitrc, but i'll modify it so it first checks to see if ssh-agent is running before it tries itself.