! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
V1.28 of xinitrc - exit leaves ssh-agent running
Status:
VERIFIED: FIXED
Product:
Xfce-utils
Component:
General

Comments

Description Galen Seitz 2004-10-05 16:08:04 CEST
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.
Comment 1 Brian J. Tarricone (not reading bugmail) 2004-10-05 18:07:53 CEST
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.
Comment 2 Brian J. Tarricone (not reading bugmail) 2004-10-06 00:26:40 CEST
fixed in CVS (after the usual anoncvs delay)
Comment 3 Galen Seitz 2004-10-12 14:53:30 CEST
Fix confirmed.  Thanks!
Comment 4 John Mylchreest 2004-11-17 00:38:48 CET
I seem to still suffer this problem in 4.1.91
can anyone offer me some advice?
Comment 5 Brian J. Tarricone (not reading bugmail) 2004-11-17 00:45:38 CET
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.
Comment 6 John Mylchreest 2004-11-17 00:50:43 CET
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 :(
Comment 7 Brian J. Tarricone (not reading bugmail) 2004-11-17 01:11:00 CET
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).
Comment 8 John Mylchreest 2004-11-17 16:57:23 CET
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.
Comment 9 Brian J. Tarricone (not reading bugmail) 2004-11-18 03:47:07 CET
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.

Bug #363

Reported by:
Galen Seitz
Reported on: 2004-10-05
Last modified on: 2009-07-14

People

Assignee:
Xfce Bug Triage
CC List:
1 user

Version

Attachments

Additional information