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

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

Re: Running emacs as root


From: Micha Feigin
Subject: Re: Running emacs as root
Date: Fri, 9 Jan 2004 01:36:14 +0200
User-agent: Mutt/1.5.5.1+cvs20040105i

On Wed, Jan 07, 2004 at 07:54:27PM -0800, Ted Weatherly wrote:
> Is there a way to change my environment while executing a command?
> 

You can append the environment setting on the commend line, for example

<var>=<value> <command>

will run <command> with <var>=<value> in its environment.

> Henrik Enberg <henrik.enberg@home.se> 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".
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
> 




reply via email to

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