Commit 2c7e4eb6c387

Vincent Demeester <vincent@sbr.pm>
2026-01-08 10:36:26
fix(emacs): Prevent YubiKey agent blocking TRAMP SSH connections
- Bypass YubiKey authentication for Emacs remote file editing - Resolve TRAMP connection failures with IdentitiesOnly option - Prevent SSH agent refusal errors during remote operations
1 parent 64ff8b7
Changed files (1)
tools
emacs
tools/emacs/init.el
@@ -370,6 +370,16 @@ minibuffer, even without explicitly focusing it."
   (tramp-copy-size-limit (* 1024 1024)) ;; 1MB
   (tramp-verbose 2)
   :config
+  ;; Add custom SSH options to disable YubiKey agent for TRAMP connections
+  (with-eval-after-load 'tramp-sh
+    (setq tramp-use-ssh-controlmaster-options nil)
+    (let ((ssh-method (assoc "ssh" tramp-methods)))
+      (when ssh-method
+        (let* ((login-args (cadr (assq 'tramp-login-args (cdr ssh-method))))
+               (new-login-args (append login-args
+                                      '(("-o" "IdentitiesOnly=yes")
+                                        ("-o" "IdentityAgent=none")))))
+          (setf (cadr (assq 'tramp-login-args (cdr ssh-method))) new-login-args)))))
   (connection-local-set-profile-variables
    'remote-direct-async-process
    '((tramp-direct-async-process . t)))