Search code examples
macosemacssudoaquamacs

How do I open a file for edit as root with Aquamacs?


I'm using Aquamacs to do most of my text editing, and would like to, selectively, open some files as root when editing them.

Is there a way for me to open some files as root with Aquamacs (and not the rest)?

I know that I can just start Aquamacs with a sudo command, but that's a bit too risky for me - I'd rather only have root permissions for editing files which absolutely require it.


Solution

  • You can open a file as root using TRAMP (bundled with Emacs since version 22.1):

    C-x C-f /sudo:root@localhost:/path/to/file RET

    If you don't insert the username@host part, TRAMP defaults to root@localhost when using /sudo, so you can shorten the syntax to

    C-x C-f /sudo::/path/to/file RET