I'm administrating an Arch Linux server.

How can I securely add emacs to my /etc/sudoers editor variable? Currently I have "emacs" but that allows M-x shell. Basically, I want something like rvim, but for emacs.

  • 4
    How does that help? They could just write a new /etc/passwd or /etc/sudoers if they have access to write files as root. – jordanm Aug 13 '13 at 21:38
  • I'd try to answer this but there are a lot of directions. Take a look at this post, I believe it has what you're looking for: emacs-fu.blogspot.com/2011/12/… – slm Aug 13 '13 at 23:37
  • @jordanm it could help if you allow only one file e.g. allowing [editor] /etc/pacman.conf instead of just [editor]. – strugee Aug 14 '13 at 1:55
  • 1
    OK, thanks for checking it out, I don't use emacs but know what you're looking for similar to rvim. I'll keep looking. – slm Aug 14 '13 at 2:02
  • 2
    if you only allow runing editor /etc/foo, that still runs the editor as root and doesn't prevent it from opening other files. If you want to give a user access to write a file, use ACLs, not sudo. – jordanm Aug 14 '13 at 4:55

You probably can't do that.

Emacs is a Lisp Interpreter that runs an editor (which is written in emacs lisp), so every time you use emacs, you have access to the the lisp interpreter itself.

That interpreter can do all kinds of things: create/remove files or directories, change access rights etc... Basically, once you're inside emacs, you do not need to have access to a shell to do considerable damage - emacs itself is powerful enough.

Your best bet is probably to find a small emacs clone (for example here: http://www.emacswiki.org/emacs/EmacsImplementations ) that supports restricted editing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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