Weblog entry #1 for yaarg
One thing that I haven't found a solution for yet though, is how I edit a root owned file from an already open emacs? At the moment, I switch to an xterm and open it up with 'sudo vim' but it would be nice if there was a "open this next buffer with sudo" command?
Comments on this Entry
[ Send Message | View Steve's Scratchpad | View Weblogs ]
One approach (if you allow root to SSH into your localhost) is to install "tramp". If you do that and place the following inside ~/.emacs then you can open files via SSH:
(require 'tramp) (setq tramp-default-method "ssh")
For example to open /etc/shadow you'd run:
C-x C-f /root@localhost:/etc/shadow
For more details look at the HTML files installed in /usr/share/doc/tramp.
[ Parent | Reply to this comment ]
$ sudo vi /etc/shadow
[ Parent | Reply to this comment ]
This opens a file as root on the local host using 'su'. The alternative is available with /sudo::/etc/passwd, which uses sudo. See the tramp manual for more information
[ Parent | Reply to this comment ]
C-x C-f /[su/]/path/to/file
and so forth. see the documentation for tramp.
[ Parent | Reply to this comment ]