help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs idiom for sudo


From: Michael Albinus
Subject: Re: emacs idiom for sudo
Date: Tue, 22 May 2007 22:45:53 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.0.91 (gnu/linux)

Tim X <address@hidden> writes:

> Amy Templeton <address@hidden> writes:
>
>> Tim X <address@hidden> wrote:
>>> "Rustom Mody" <address@hidden> writes:
>>> > Is there a more convenient way for doing 'root-things' than
>>> > -- get out of emacs (maybe suspend)
>>> > -- start a shell
>>> > -- sudo editor (usually vi) OR su ... password... editor
>>
>>> I use tramp to do this. Essentially, using either a 'su' or 'sudo' tramp 
>>> method
>>> to edit a local file. This is described in the tramp manual.
>>
>> What about executing some elisp code as root (obviously including a
>> password prompt, not just executing it without any question)? Or is
>> it necessary to just start a whole new Emacs? I didn't see anything
>> about this in the tramp manual, but I might not be looking hard
>> enough.
>>
>
> Thats going to be considerably harder to do. The tramp method for editing 
> files
> works well because all your really doing is wrapping  find-file and save-file
> inside scp/ssh and hiding all the gory/boring details under elisp. However,
> executing a command as another user from within emacs is a bit more difficult,
> depending on the command you want to run. 

<advertising>
Tramp 2.1 (NOT part of Emacs 22.1) provides an implementation for
call-process and start-process, which let's the corresponding processes
run on the remote host when default-directory points to such. It is
experimental code, but it does a good job for me also in the sudo case
(no wonder, I did implement it :-)

It also cooperates with compile.el, grep.el, gdb.el, eshell.el - just to
mention the major packages I apply myself.
</advertising>

> Tim

Best regards, Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]