Suppose I want to open a file in an existing Emacs session using su or sudo, without dropping down to a shell and doing sudoedit or sudo emacs. One way to do this is
C-x C-f /sudo::/path/to/file but this requires an expensive round-trip through SSH. Is there a more direct way?
[EDIT] @JBB is right. I want to be able to invoke su/sudo to save as well as open. It would be OK (but not ideal) to re-authorize when saving. What I'm looking for is variations of find-file and save-buffer that can be "piped" through su/sudo.
C-x C-f /sudo::/path/to/filedocumented?Trampis documented in Emacs standard manual. Start info withC-h ithen goto Tramp top info noed withg (tramp), ormTRAMP. Go togQuickstart Start Guide: su, sudo and sg methodswhich is section 3.3 in Tramp manual.C-x C-f /su::/path/to/file