all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* different color for root
@ 2004-03-04 12:11 Fabian Braennstroem
  2004-03-04 16:00 ` Kevin Rodgers
  2004-03-05  7:35 ` Fabian Braennstroem
  0 siblings, 2 replies; 9+ messages in thread
From: Fabian Braennstroem @ 2004-03-04 12:11 UTC (permalink / raw)


Hello,

I have two different '.emacs' for me and 'root'; mainly just a change in the
background-color. But starting Emacs for root under xfree does have the same
color as starting it for me (user). Even uncommenting 'ecb' for root does not
have any affect, it still loads. 
What do I do wrong?

Greetings!
-- 
Fabian Braennstroem
Duesseldorf/Berlin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: different color for root
  2004-03-04 12:11 different color for root Fabian Braennstroem
@ 2004-03-04 16:00 ` Kevin Rodgers
  2004-03-04 18:35   ` Floyd L. Davidson
  2004-03-04 18:48   ` Fabian Braennstroem
  2004-03-05  7:35 ` Fabian Braennstroem
  1 sibling, 2 replies; 9+ messages in thread
From: Kevin Rodgers @ 2004-03-04 16:00 UTC (permalink / raw)


Fabian Braennstroem wrote:
 > I have two different '.emacs' for me and 'root'; mainly just a change in the
 > background-color. But starting Emacs for root under xfree does have the same
 > color as starting it for me (user). Even uncommenting 'ecb' for root does not
 > have any affect, it still loads.
 > What do I do wrong?

How are you "starting Emacs for root under xfree"?  I will guess that
you're logged in as yourself, running a shell in an xterm, and then use
su to become root before starting emacs.  In that case, root is the
effective user but you are still the real user.  I think you can solve
your problem by using `su -` so that root is the real user, or by
starting Emacs as `emacs -u root` to load it's .emacs file.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: different color for root
  2004-03-04 16:00 ` Kevin Rodgers
@ 2004-03-04 18:35   ` Floyd L. Davidson
  2004-03-04 18:48   ` Fabian Braennstroem
  1 sibling, 0 replies; 9+ messages in thread
From: Floyd L. Davidson @ 2004-03-04 18:35 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> wrote:
>Fabian Braennstroem wrote:
> > I have two different '.emacs' for me and 'root'; mainly just a change in the
> > background-color. But starting Emacs for root under xfree does have the same
> > color as starting it for me (user). Even uncommenting 'ecb' for root does not
> > have any affect, it still loads.
> > What do I do wrong?
>
>How are you "starting Emacs for root under xfree"?  I will guess that
>you're logged in as yourself, running a shell in an xterm, and then use
>su to become root before starting emacs.  In that case, root is the
>effective user but you are still the real user.  I think you can solve
>your problem by using `su -` so that root is the real user, or by
>starting Emacs as `emacs -u root` to load it's .emacs file.

That might cause other problems, in particular the manner in
which one su's to root has a lot of side effects.

I would make the /root/.emacs file a symlink to the user's
~/.emacs file.  That will cause both that user and root to
always read the same init file, whether root is root because of
a real login, sudo, or su.  (That makes sense on a home machine.
On a larger system with multiple system admins, don't do that.
Instead, install the most *obnoxious* set of interactive
defaults possible for emacs and everything else, to absolutely
discourage any system admin from directly logging in as root as
opposed to using su.)

Put something like this into ~/.emacs, with appropriate changes
of foreground or background colors.

 (if (eq (user-uid) 0)
    (progn
      (set-face-background 'default "black")
      (set-face-foreground 'default "green"))
   (progn
      (set-face-background 'default "black")
      (set-face-foreground 'default "goldenrod2")))

Root will be green on black, the regular user will be goldenrod2
on black.  (I use a black background and normally a goldenrod2
foreground, so switching to green seemed a reasonable way to
test this.)

That also means various font-lock-face colors have to be chosen
to work well with both possible combinations of foreground and
background.

--
Floyd L. Davidson           <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         floyd@barrow.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: different color for root
  2004-03-04 16:00 ` Kevin Rodgers
  2004-03-04 18:35   ` Floyd L. Davidson
@ 2004-03-04 18:48   ` Fabian Braennstroem
  2004-03-05  0:57     ` Roberto Quiroga
  2004-03-05  1:04     ` Kevin Rodgers
  1 sibling, 2 replies; 9+ messages in thread
From: Fabian Braennstroem @ 2004-03-04 18:48 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Fabian Braennstroem wrote:
>  > I have two different '.emacs' for me and 'root'; mainly just a change in the
>  > background-color. But starting Emacs for root under xfree does have the same
>  > color as starting it for me (user). Even uncommenting 'ecb' for root does not
>  > have any affect, it still loads.
>  > What do I do wrong?
>
> How are you "starting Emacs for root under xfree"?  I will guess that
> you're logged in as yourself, running a shell in an xterm, and then use
> su to become root before starting emacs.  In that case, root is the
> effective user but you are still the real user.  I think you can solve
> your problem by using `su -` so that root is the real user, or by
> starting Emacs as `emacs -u root` to load it's .emacs file.

Thanks!
But using 'su -' helps being the real root-user, but emacs starts
non-graphical. And 'emacs -u root' does not give me root rights. Do you have a
third idea?

Greetings!
-- 
Fabian Braennstroem
Duesseldorf/Berlin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: different color for root
  2004-03-04 18:48   ` Fabian Braennstroem
@ 2004-03-05  0:57     ` Roberto Quiroga
  2004-03-05 12:03       ` Reiner Steib
  2004-03-05  1:04     ` Kevin Rodgers
  1 sibling, 1 reply; 9+ messages in thread
From: Roberto Quiroga @ 2004-03-05  0:57 UTC (permalink / raw)


Fabian Braennstroem <f.braennstroem@gmx.de> escribió:

> Kevin Rodgers <ihs_4664@yahoo.com> writes: But using 'su -' helps
> being the real root-user, but emacs starts non-graphical. And 'emacs
> -u root' does not give me root rights. Do you have a third idea?


cube:/home/rquiroga $ xhost + localhost 
localhost being added to access control list
cube:/home/rquiroga $ su -              
Password:
Terminal type? [screen] 
cube# emacs -display :0

Hope this helps.
-- 
Roberto Quiroga

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: different color for root
  2004-03-04 18:48   ` Fabian Braennstroem
  2004-03-05  0:57     ` Roberto Quiroga
@ 2004-03-05  1:04     ` Kevin Rodgers
  1 sibling, 0 replies; 9+ messages in thread
From: Kevin Rodgers @ 2004-03-05  1:04 UTC (permalink / raw)


Fabian Braennstroem wrote:
 > But using 'su -' helps being the real root-user, but emacs starts
 > non-graphical.

That's because the new login shell does not inherit the DISPLAY
environment variable.  You need to explicitly set it and export it
before starting emacs.

 > And 'emacs -u root' does not give me root rights. Do you have a
 > third idea?

If you just want to edit files (vs. execute shell commands via M-!
etc.), visit them via ange-ftp: C-x C-f /root@localhost:/etc/passwd RET

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: different color for root
  2004-03-04 12:11 different color for root Fabian Braennstroem
  2004-03-04 16:00 ` Kevin Rodgers
@ 2004-03-05  7:35 ` Fabian Braennstroem
  1 sibling, 0 replies; 9+ messages in thread
From: Fabian Braennstroem @ 2004-03-05  7:35 UTC (permalink / raw)


Hello,

thanks to everybody! I use the setup from Floyd.

Greetings!
-- 
Fabian Braennstroem
Duesseldorf/Berlin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: different color for root
  2004-03-05  0:57     ` Roberto Quiroga
@ 2004-03-05 12:03       ` Reiner Steib
  2004-03-05 13:13         ` Fabian Braennstroem
  0 siblings, 1 reply; 9+ messages in thread
From: Reiner Steib @ 2004-03-05 12:03 UTC (permalink / raw)


On Fri, Mar 05 2004, Roberto Quiroga wrote:

> Fabian Braennstroem <f.braennstroem@gmx.de> escribió:
>
>> But using 'su -' helps being the real root-user, but emacs starts
>> non-graphical. And 'emacs -u root' does not give me root rights. Do
>> you have a third idea?

Either:

$ su -
# export XAUTHORITY=~fabian/.Xauthority; export DISPLAY=":0";

or:

ssh -X root@localhost

> cube:/home/rquiroga $ xhost + localhost 
> localhost being added to access control list

Very bad idea.  This is a security hole, especially in multi-user
environments.

Fabian, in news:de.comp.os.unix.linux.infos you will find a very good
article (in German) dealing with this.  The subject is "Alle Macht dem
User" or similar.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: different color for root
  2004-03-05 12:03       ` Reiner Steib
@ 2004-03-05 13:13         ` Fabian Braennstroem
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Braennstroem @ 2004-03-05 13:13 UTC (permalink / raw)


Reiner Steib <4.uce.03.r.s@nurfuerspam.de> writes:

> On Fri, Mar 05 2004, Roberto Quiroga wrote:
>
>> Fabian Braennstroem <f.braennstroem@gmx.de> escribió:
>>
>>> But using 'su -' helps being the real root-user, but emacs starts
>>> non-graphical. And 'emacs -u root' does not give me root rights. Do
>>> you have a third idea?
>
> Either:
>
> $ su -
> # export XAUTHORITY=~fabian/.Xauthority; export DISPLAY=":0";
>
> or:
>
> ssh -X root@localhost
>
>> cube:/home/rquiroga $ xhost + localhost 
>> localhost being added to access control list
>
> Very bad idea.  This is a security hole, especially in multi-user
> environments.
>
> Fabian, in news:de.comp.os.unix.linux.infos you will find a very good
> article (in German) dealing with this.  The subject is "Alle Macht dem
> User" or similar.

Thanks Reiner!

Greetings!


-- 
Fabian Braennstroem
Duesseldorf/Berlin

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-03-05 13:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-04 12:11 different color for root Fabian Braennstroem
2004-03-04 16:00 ` Kevin Rodgers
2004-03-04 18:35   ` Floyd L. Davidson
2004-03-04 18:48   ` Fabian Braennstroem
2004-03-05  0:57     ` Roberto Quiroga
2004-03-05 12:03       ` Reiner Steib
2004-03-05 13:13         ` Fabian Braennstroem
2004-03-05  1:04     ` Kevin Rodgers
2004-03-05  7:35 ` Fabian Braennstroem

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.