2

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

$ sudo grep NOPASSWD /etc/sudoers
%wheel ALL=(ALL) NOPASSWD: ALL

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`? – Scott Weldon May 12 '15 at 20:20
  • Archlinux with emacs 24.5.1. I can't repro it with `emacs -Q`. – Joe Hillenbrand May 12 '15 at 22:33
  • Sounds like it is time to [bisect your init file](http://stackoverflow.com/a/23772957/2747593) then. [This package](https://github.com/Malabarba/elisp-bug-hunter) might also be helpful. – Scott Weldon May 12 '15 at 22:45

1 Answers1

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))))