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?

Startec
  • 1,354
  • 1
  • 13
  • 30

2 Answers2

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

Konstantin Morenko
  • 1,407
  • 9
  • 19
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.

smonff
  • 1,575
  • 1
  • 15
  • 20