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: Tim X
Subject: Re: emacs idiom for sudo
Date: Wed, 23 May 2007 14:13:56 +1000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

"foo@bar.baz" <Simon.Me@gmail.com> writes:

> On May 22, 10:29 am, Tim X <t...@nospam.dev.null> wrote:
>> You may be able to do something with emacsclient, but you woul dstill need an
>> emacs running somewhere as the user you want th e code to run as.
>>
>> Probably more of a hassle than its worth - but that depends on your
>> environment/needs I guess.
>
> I often use emacsclient to edit files from the terminal. With files
> that I have to edit as root I have to switch to emacs, start tramp,
> find the file...
> Is it possible to use emacsclient with sudo?
>

No, from your description its not going to work. If you think about processes,
shells and permissions, the problems are fairly clear. When you run sudo, you
start a new shell process running as the user you have sudo'd to. If you wanted
to use emacsclient to edit the file, emacsclient would need an emacs running as
that user that it can pass to, but if you have emacs running as that user, why
would you bother sudoing to that user to edit the file - you would just edit it
within the emacs running as that user. 

For editing files as another user (such as root), the easiest solution is just
to use tramp. Executing a program as another user from within emacs can be done
via an emacs term, in which you run sudo. running some elisp as another user is
much more difficult because of the seperation of privileges that is the
foundation of the security model under *nix systems.

Tim

-- 
tcross (at) rapttech dot com dot au


reply via email to

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