Allowing xfce4-session to use external ssh-agent

Ivan Kabaivanov ivan.kabaivanov at
Sun Nov 19 01:51:39 CET 2017


I've been using xfce for almost two years after having used kde for 19.  I love xfce and I would like to thank each and every developer who has worked and is working on it.

I would like to request a feature and I am submitting a patch for your consideration.

I very often work on my machines remotely and start ssh-agent via a set of commands in .bashrc,  so I always have a running ssh-agent, even before starting xfce.  I would like to xfce to use the already running ssh-agent.

Here's a very crude patch that I've tested and have confirmed as working.  I'm sure I am forgetting some cases.  But I would like your critique and input on the feasibility of this patch making it into xfce.

--- xfce4-session-4.13.0.original/xfce4-session/xfsm-startup.c  2014-09-28 17:51:01.000000000 +0300
+++ xfce4-session-4.13.0/xfce4-session/xfsm-startup.c   2017-11-19 02:15:05.108424383 +0200
@@ -199,6 +199,7 @@
   gchar       *ssh_agent;
   gchar       *ssh_agent_path = NULL;
+  gchar       *ssh_agent_socket = NULL;
   gchar       *gpg_agent_path = NULL;
   gchar       *cmd;
   pid_t        agentpid;
@@ -256,6 +257,14 @@
       g_free (ssh_agent);
+  else
+    {
+      if (xfconf_channel_get_bool (channel, "/startup/ssh-agent/external", TRUE))
+        {
+          ssh_agent_socket = xfconf_channel_get_string (channel, "/startup/ssh-agent/external_socket", NULL);
+          g_setenv ("SSH_AUTH_SOCK", ssh_agent_socket, TRUE);
+        }
+    }

   if (G_LIKELY (ssh_agent_path != NULL || gpgagent_ssh_enabled))

In order to use an external ssh-agent, you need to set two new properties:

xfconf-query -c xfce4-session -p /startup/ssh-agent/external -n -t string -s true

xfconf-query -c xfce4-session -p /startup/ssh-agent/external_socket -n -t string -s PATH_TO_SSH_SOCKET

 I start ssh-agent like so:
 ssh-agent -a PATH_TO_SSH_SOCKET so the socket location never changes.
  I would appreciate your feedback.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Xfce4-dev mailing list