2

The question pretty much says it all. I opened emacs as a regular user and am trying to edit something in the /etc/ folder (I know this is dangerous etc. etc.)

How can I do this?

2 Answers 2

4

You could use https://stackoverflow.com/questions/95631/open-a-file-with-su-sudo-inside-emacs, for example C-x C-f /sudo::/path/to/file

1
  • True. I guess this question should be closed or linked to that answer directly.
    – Startec
    Commented Jul 12, 2016 at 6:07
0

There is packages that gives some utilities functions for this:

  • sudo-edit for opening buffers as root
  • dired-toggle-sudo for switching from current user to sudo when browsind dired buffers.

Also see the Edit file with super-user rights question.

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.