Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I really hate about sudoedit is the fact that it always uses a different filename. I'm using emacsclient and when editing a file twice I'm left with two useless buffers. Sometimes I even happen to edit the "stale" file.

Is there something like sudoedit which uses always the same filename, ideally one the user could choose?

I'm thinking about writing a script allowing me to edit e.g. /etc/fstab by editing $HOME/global/etc/fstab instead, but I see some problems with keeping the files in sync and also possible security issues (which aren't that important on my single user machine).

share|improve this question
Not sure about an answer to the question in the subject, but if you're after an Emacs solution, have a look here, SO's "Open a file with su/sudo inside Emacs" has some information on how tramp can do that. – sr_ Apr 14 '12 at 17:48
Good to know. However, I don't really like it: 1. Tramp ignores numpad keys when reading the password. 2. The backup files get written as ~/%backup%~. 3. I'd really prefer saving a copy somewhere in my home directory for future reference, possibly versioning, and future re-installs. – maaartinus Apr 14 '12 at 19:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.