1. Log into Gnome
  2. emacs-server is started by systemd, using the default configuration of my distribution (Fedora 36):
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

ExecStart=/usr/bin/emacs --fg-daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
# The location of the SSH auth socket varies by distribution, and some
# set it from PAM, so don't override by default.
# Environment=SSH_AUTH_SOCK=%t/keyring/ssh

  1. Start an emacs-client frame using the Gnome shell.

At this point I can use magit and pull and push remote commits without typing my ssh key passphrase.

  1. Start an emacs frame (not a client) using the Gnome shell.

At this point I also can use my ssh key without typing the passphrase.

  1. Start an emacs-client frame using the Gnome shell.

I try to pull from my remote, emacs asks me for my ssh key passphrase.

I'm puzzled. I really would like to be able to continue using my ssh keys without typing the passphrase on subsequent emacs-client frames. This glitch becomes really annoying when I'm using emacs across multiple physical screens.

  • Is (emacs-pid) returning the same value in both client frames?
    – phils
    Commented Jul 11, 2022 at 20:08
  • @phils no, I get different values. How do I fix that? I'm starting emacs with a desktop laucher using the command emacsclient -c -a ""
    – dmvianna
    Commented Jul 11, 2022 at 23:23
  • So that's the issue -- two independent Emacs instances/servers, only one of which knows about your SSH config. You'll have to check what "emacs-server is started by systemd" is actually doing. (I can't guess what that would be, sorry.)
    – phils
    Commented Jul 12, 2022 at 2:22
  • @phils I added the configuration above.
    – dmvianna
    Commented Jul 12, 2022 at 3:38
  • Oh, I can just create a new frame instead of starting a client! Ctrl-x 5 2 or make-frame or make-frame-on-monitor... As usual, there's a command for it, but finding which one is the trick.
    – dmvianna
    Commented Jul 12, 2022 at 4:23

1 Answer 1


The problem was that emacsd wasn't aware of $XAUTHORITY, which controls authentication within X. I now included it within the environment variables emacsd is aware of using exec-path-from-shell.

(use-package exec-path-from-shell
  :straight t
    (add-to-list 'exec-path-from-shell-variables var))

If you're wondering, I include $PATH so that lsp can find executables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.