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