On (what I’ve noticed so far) Ubuntu based distros, one thing that bugged me was that on a fresh install when you sudo into root and edit for example a config file, all comments were in dark blue color (which on a terminal with black background is terrible) but when doing it as a normal user the color theme was more pleasing (readable).
This is how I ”fix” this.
First, add these two lines to /etc/profile (which is read by /bin/bash /bin/dash /bin/sh etc at login)
sudo echo 'export COLORFGBG="15;0"' >> /etc/profile
Then, add this line in your /etc/sudoers file to keep the setting.
Defaults env_keep += "COLORFGBG"
Which makes sudo remember the COLORFGBG setting. You can add other stuff here as well, for instance maybe you want’t to be able to run stuff that only you have in your PATH with sudo.
Now when you login, and sudo edit a file you get bright colors. Yay! But wait, It don’t work you say? Well, I’m guessing you run KDE or some other fancy DE and it’s terminal. Most terminals for X do run bash, but they don’t run it as a login shell, so they don’t source /etc/profile and hence the settings above won’t do any good.
My solution is to add ”-l” to the command line starting bash, which makes bash behave as it’s running as a login shell.
Here’s how to do it in Konsole in KDE: