RFC: root/non-root bash prompts different colours?

David Woodhouse dwmw2 at infradead.org
Thu Dec 9 10:13:09 UTC 2004


On Wed, 2004-12-08 at 14:00 -0400, Ben Steeves wrote:
> Personally, all my root prompts are reversed video, with the
> background colour different on different servers.  It helps when you
> have root shells on four or five boxes open at once... wouldn't want
> to shutdown the wrong server, now would we ;-)

That one I tend to fix by renaming /sbin/reboot to "reboot-`hostname`".
You also have to make a script called 'reboot' which says something
along the lines of "if you're sure, use reboot-`hostname`", or you'll
confuse other admins and tab-completion will bite you anyway :)

I really don't see the point in changing colours in the prompt. If the
user is unaware of the distinction and the danger of doing things as
root, changing the colour of the prompt isn't going to help. If the user
_is_ aware of the difference, then the standard $/# indicator is
sufficient.

Adding an extra line of warning beforehand is slightly less obnoxious,
but really only slightly so. I can just about manage at the moment to
put up with the 'new' ([\u@\h \W]\\$; introduced circa 1996?) prompt
when I'm root, but if such a change is made I'll actually have to go and
change it on all the machines I run. The hash sign is perfectly
sufficient.

-- 
dwmw2




More information about the devel mailing list