Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Change the appearance for the root account' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change the appearance for the root account
Authored by: overrider on May 20, '05 10:44:30PM

i never use root to login into my system initially, but quiet often i change to root in the terminal via sudo su. to know and be aware that i am root, i did this:
open terminal
type sudo su followed by your password
type cd ~ to change to roots home directory
your terminal should look similar to this [root@machinename:~]$
type pico .bashrc to create a new .basrc profile file
copy and paste : declare -x PS1="\[\033[0;31m\][\u@\h:\w]$\[\033[0m\] "
hit ctrl+x followed by y to close and save the file
type exit and close the terminal
now when you open the terminal again and use sudo su to change to the root user, the root users command line will appear as a nice red to make sure you are aware.

[ Reply to This | # ]
Change the appearance for the root account
Authored by: hombre on May 22, '05 12:48:08AM

This is very helpful. I have always wished I could make the Terminal background a different color when I su to root, but I don't think that is possible, and the red text is hard to miss. It feels weird to me to have a '$' instead of '#' in the prompt, though.

[ Reply to This | # ]
Change the appearance for the root account
Authored by: devlogic on May 23, '05 04:16:37AM

That's easy enough to fix, though; just change the "$" to "\$" (only works in bash, not tcsh); the shell will automagically change the '$' to '#' for the root shell. Or, since the outlined procedure explicitly creates/changes the root .bashrc (and not your personal .bashrc), just use a '#' instead of a '$' in the PS1 variable declaration to begin with.

[ Reply to This | # ]
Change the appearance-->TCSH
Authored by: macubergeek on May 22, '05 10:30:44AM

If you use TCSH put this line at the top of your root account's .tcshrc file:
edit /private/var/root/.tcshrc

set prompt="%{\033[31m%}%n @ %/@Xmac-->"

will turn the prompt red

[ Reply to This | # ]