unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim X <timx@nospam.dev.null>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs idiom for sudo
Date: Wed, 23 May 2007 14:13:56 +1000	[thread overview]
Message-ID: <87odkcch2z.fsf@lion.rapttech.com.au> (raw)
In-Reply-To: 1179843916.583993.14130@x35g2000prf.googlegroups.com

"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

  parent reply	other threads:[~2007-05-23  4:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.880.1179633671.32220.help-gnu-emacs@gnu.org>
2007-05-20  5:58 ` emacs idiom for sudo Tim X
2007-05-22  4:18   ` Amy Templeton
     [not found]   ` <mailman.947.1179807172.32220.help-gnu-emacs@gnu.org>
2007-05-22  8:29     ` Tim X
2007-05-22 14:25       ` foo@bar.baz
2007-05-22 17:11         ` Peter Dyballa
2007-05-22 21:45         ` Xavier Maillard
2007-05-23  4:13         ` Tim X [this message]
2007-05-22 20:45       ` Michael Albinus
     [not found]       ` <mailman.1025.1179866756.32220.help-gnu-emacs@gnu.org>
2007-05-23  4:18         ` Tim X
2007-05-22 22:53     ` David Kastrup
2007-05-23 10:33       ` reader
2007-05-23 12:02         ` Peter Dyballa
2007-05-20  4:01 Rustom Mody
2007-05-20  5:19 ` Eric Hanchrow
2007-05-21 12:07   ` Rustom Mody
2007-05-22  2:38   ` Matthew Flaschen
2007-05-22  4:38 ` Xavier Maillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87odkcch2z.fsf@lion.rapttech.com.au \
    --to=timx@nospam.dev.null \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).