Opening /sudo::/etc/hosts with tramp prompts for a password even though I have passwordless sudo. I use ido.

$ sudo grep NOPASSWD /etc/sudoers

Is there any way to fix this?

  • 1
    I wasn't able to reproduce this on Debian 7 with Emacs 23.4.1. What distro / Emacs version are you using? Does the problem occur when starting Emacs with emacs -Q? Commented May 12, 2015 at 20:20
  • Archlinux with emacs 24.5.1. I can't repro it with emacs -Q. Commented May 12, 2015 at 22:33
  • Sounds like it is time to bisect your init file then. This package might also be helpful. Commented May 12, 2015 at 22:45

1 Answer 1


The issue seemed to have something to do with ido, so I added Option B from here and it works great.

(defadvice ido-find-file (after find-file-sudo activate)
  "Find file as root if necessary."
  (unless (and buffer-file-name
              (file-writable-p buffer-file-name))
    (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))

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.