unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Henrik Enberg <henrik.enberg@home.se>
Subject: Re: Running emacs as root
Date: Wed, 07 Jan 2004 20:33:29 +0100	[thread overview]
Message-ID: <8765fnr1ti.fsf@home.se> (raw)
In-Reply-To: d365ef4b.0401071045.7f8a841b@posting.google.com

tbonemp3@yahoo.com (Ted Weatherly) writes:

> To run emacs as root, I normally 'su' then 'emacs'.  I'd like to
> create a script to simplify this.  I try:
>
> sudo -u root /bin/sh -c "emacs"
>
> ...and I'm able to edit files as root.  But when I run a shell within
> emacs, my prompt displays as if I'm a regular user (i.e. it shows as
> "/tmp> " but I want "/tmp# ").  So it appears as if emacs is using the
> .profile of the regular user.   How do I fix this?  

sudo doesn't change your environment, you'd have to use su for that.

> Perhaps there is a better way to launch emacs as root?

I use tramp.el (see http://savannah.nongnu.org/projects/tramp/) to open
files as root with sudo within the running emacs.  When tramp is
installed simply do "C-x f /sudo:root@localhost:/path/to/file".

  reply	other threads:[~2004-01-07 19:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 18:45 Running emacs as root Ted Weatherly
2004-01-07 19:33 ` Henrik Enberg [this message]
2004-01-08  3:54   ` Ted Weatherly
2004-01-08 23:36     ` Micha Feigin
2004-01-11  1:11     ` gebser

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=8765fnr1ti.fsf@home.se \
    --to=henrik.enberg@home.se \
    /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).