Is there a way to open a local file for editing as a root? I need to make some changes to a config file located at ~/.emacs.d/init.el, but the Emacs tells me that the buffer is read-only.

  • Note that you should not need root permissions to edit a file located under your home directory. Check what you're doing. – Gilles 'SO- stop being evil' Oct 5 '17 at 20:17
  • Not if the owner of that file is root. Then it does not matter in which directory the file is located. – MadPhysicist Oct 5 '17 at 20:23
  • 1
    That's my point: root should not own that file. You should fix that. – Gilles 'SO- stop being evil' Oct 5 '17 at 20:30
  • 1
    Does the file exist? Have you or your administrator configured Tramp? Can you reproduce the problem when you start Emacs with emacs -Q ? – Gilles 'SO- stop being evil' Oct 5 '17 at 20:43
  • 1
    @MadPhysicist: /sudo:: is tramp shorthand for /sudo:root@<host>: – phils Oct 5 '17 at 21:08