From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: tbonemp3@yahoo.com (Ted Weatherly) Newsgroups: gmane.emacs.help Subject: Re: Running emacs as root Date: 7 Jan 2004 19:54:27 -0800 Organization: http://groups.google.com Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <8765fnr1ti.fsf@home.se> NNTP-Posting-Host: deer.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1073535124 15746 80.91.224.253 (8 Jan 2004 04:12:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Jan 2004 04:12:04 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 08 05:12:02 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AeRWb-00030P-00 for ; Thu, 08 Jan 2004 05:12:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AeSIc-00005u-Uo for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Jan 2004 00:01:38 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-NNTP-Posting-Host: 63.211.143.38 Original-X-Trace: posting.google.com 1073534067 23222 127.0.0.1 (8 Jan 2004 03:54:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 8 Jan 2004 03:54:27 +0000 (UTC) Original-Xref: shelby.stanford.edu gnu.emacs.help:119856 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:15799 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15799 Is there a way to change my environment while executing a command? Henrik Enberg wrote in message news:<8765fnr1ti.fsf@home.se>... > 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".