Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

.emacs file in root?

2 views
Skip to first unread message

saneman

unread,
Apr 18, 2008, 7:11:31 AM4/18/08
to
When I open a root file with emacs it does not use my settings specified
in my ~/.emacs.

How do I make emacs use the config file ~/.emacs also when used in root
mode?

Thierry Volpiatto

unread,
Apr 18, 2008, 7:59:36 AM4/18/08
to saneman, help-gn...@gnu.org
saneman <d...@sdf.com> writes:

> When I open a root file with emacs it does not use my settings
> specified in my ~/.emacs.

root is just like another user on your system and thats normal it don't
use your settings!

> How do I make emacs use the config file ~/.emacs also when used in
> root mode?

you can use another .emacs special for root.
It's may be not a good idea to try to use the same config you use as
simple user for root.(gnus, w3m ...etc...)
--
A + Thierry
Pub key: http://pgp.mit.edu


saneman

unread,
Apr 18, 2008, 8:04:07 AM4/18/08
to
> you can use another .emacs special for root.

How?

Jonathan Groll

unread,
Apr 18, 2008, 8:29:17 AM4/18/08
to saneman, help-gn...@gnu.org
On Fri, Apr 18, 2008 at 01:11:31PM +0200, saneman wrote:
> When I open a root file with emacs it does not use my settings specified
> in my ~/.emacs.

If you use "sudo emacs" you should get what you want.

Cheers,
Jonathan


Adam Funk

unread,
Apr 18, 2008, 8:40:57 AM4/18/08
to
On 2008-04-18, saneman wrote:

>> you can use another .emacs special for root.
>
> How?

Assuming root's home directory is "/root", put the customizations that
you need as root in "/root/.emacs".

Thierry Volpiatto

unread,
Apr 18, 2008, 8:47:57 AM4/18/08
to saneman, help-gn...@gnu.org
saneman <d...@sdf.com> writes:

>> you can use another .emacs special for root.
>
> How?

Just put it in /root.

Joel J. Adamson

unread,
Apr 18, 2008, 9:46:30 AM4/18/08
to saneman, help-gn...@gnu.org
Thierry Volpiatto <thierry....@gmail.com> writes:

> saneman <d...@sdf.com> writes:
>
>>> you can use another .emacs special for root.
>>
>> How?
>

> Just put it in /root.

Or use tramp: "C-xC-f /su::<filename> RET password RET"

Don't login as root.

Joel

--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
Public key: http://pgp.mit.edu

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.

Rebecca Breu

unread,
Apr 18, 2008, 9:59:14 AM4/18/08
to help-gn...@gnu.org
saneman <d...@sdf.com> wrote:

> How do I make emacs use the config file ~/.emacs also when used in root
> mode?

emacs -u <username>

starts emacs with the .emacs of another user.

Tim X

unread,
Apr 18, 2008, 11:59:01 PM4/18/08
to
saneman <d...@sdf.com> writes:

>> you can use another .emacs special for root.
>
> How?
>

The answer depends on how your are editing files as root. If your using
something like tramp to do this, I'm not sure you can.

Emacs does have a command line option that tells it to use a different
users init file. Of course, you must have read permission as the user
you are logged in as to read this other users .emacs file.

If you are switching to a root login using su, then you just need to do
su -, which will setup the subshell as a proper root subshell and
therefore will automatically source root's .emacs file rather than using
your own .emacs file.

A better solution might be to tell us what it is you are trying to do
and why sourcing root's emacs init file is required. It is likely
someone can come up with a better and more secure solution to the
problem once we know what it is.

Tim

--
tcross (at) rapttech dot com dot au

0 new messages