LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   konsole colors lost when "su" (https://www.linuxquestions.org/questions/slackware-14/konsole-colors-lost-when-su-182600/)

murray_linux 05-17-2004 04:41 PM

konsole colors lost when "su"
 
Hi again.

I've noticed that when im running Konsole in KDE the colors for different file types / folders dissapear when I su to root. After su'ing, every filetype, folder is displayed using the same color. When I exit out of the su, it returns to the normal color.

Is this normal? What is the logic behind that? I guess more importantly, how do I get the cool colors back as root?

Thanks!

Murray

david_ross 05-17-2004 04:46 PM

Perhaps you just haven't set LS_COLORS - is the output of:
export | grep LS

The same under both users?

johnp 05-17-2004 06:55 PM

I have a similar problem.

When I'm using bash and logged in under 'john' I get colors, but when I su to root I lose them. When I just log in as root I get colors

johnp 05-17-2004 06:57 PM

Quote:

Originally posted by david_ross
Perhaps you just haven't set LS_COLORS - is the output of:
export | grep LS

The same under both users?

I get this after su from john

Code:

root@johnp:/etc# export | grep LS
declare -x LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;0
1:cd=40;33;01:or=40;31;01:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;
32:*.bat=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip
=01;31:*.bz2=01;31:*.rpm=01;31:*.deb=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.jpg=
01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.
tif=01;35:*.mpg=01;35:*.avi=01;35:*.mov=01;35:"
declare -x LS_OPTIONS=" --color=auto -F -b -T 0"

this when logged in as john
Code:

john@johnp:/etc$ export | grep LS
declare -x HUSHLOGIN="FALSE"
declare -x LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.bz2=01;31:*.rpm=01;31:*.deb=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.mpg=01;35:*.avi=01;35:*.mov=01;35:"
declare -x LS_OPTIONS=" --color=auto -F -b -T 0"


this when logging in as rooot

Code:

root@johnp:/etc# export | grep LS
declare -x LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;0\
declare -x LS_OPTIONS=" --color=auto -F -b -T 0"

uh what do I need to do again?

thegeekster 05-17-2004 07:49 PM

What I've done to get a consistent look when su'ing is to source the /etc/profile file as the very first command in a user's and root's ~/,bashrc file.............So the very first command is:
Code:

source /etc/profile
This way, all the global, or system-wide environment for everyone is placed in the /etc/profle file..............If I want to customize something for a specific user or root, then it goes into that user's ~/.bashrc file.................Also, whenever you su to root or another user, the .bashrc file in that user's home directory gets read, which then rereads /etc/profile because of the 'source' command........... :)

Poetics 05-18-2004 02:34 PM

There's a big difference using "su" as opposed to "su -" --- the latter will receive all of the purdy colors from the root login (as well as other aliases you've set up), whereas the former is merely a little quickie step into rootville and so doesn't.

-- Poetics

Nichole_knc 05-18-2004 08:32 PM

see also
http://www.linuxquestions.org/questi...100#post941100
and copy your ~/.DIR_COLORS to the root home...

Kovacs 05-18-2004 08:33 PM

Add this line to your root .bashrc:

alias ls='ls --colors=auto -hF'

lyle_s 05-19-2004 09:57 PM

Re: konsole colors lost when "su"
 
Quote:

Originally posted by murray_linux colors for different file types / folders dissapear when I su to root.
Personally, I like this behavior because there's no mistaking that this konsole instance has been su'ed to root.

Lyle

p.s. This is the widest thread I've ever seen.

mooreted 12-09-2004 07:41 PM

Suggestion created strange behavior
 
I added "source /etc/profile" and "source ~/.bashrc" to the .bashrc file in /root and now Slackware's sayings are all scrolling down the screen when I try to su to root.

I can probably just delet /root/.bashrc and start over, but what caused this?

Genesee 12-09-2004 09:47 PM

Re: Suggestion created strange behavior
 
Quote:

Originally posted by mooreted
I added "source /etc/profile" and "source ~/.bashrc" to the .bashrc file in /root and now Slackware's sayings are all scrolling down the screen when I try to su to root.

I can probably just delet /root/.bashrc and start over, but what caused this?

:confused: you sourced .bashrc in .bashrc? I've never tried that, but as a wild guess that's part of the problem :D it seems that you might be in a loop, sourcing /etc/profile and .bashrc

slackware sayings? I guess you mean the BSD fortunes? if so, they are called from /etc/profile, which has this section by default:

Quote:

# Append any additional sh scripts found in /etc/profile.d/:
for file in /etc/profile.d/*.sh ; do
if [ -x $file ]; then
. $file
fi
done
try taking the source ~/.bashrc out of .bashrc

mooreted 12-10-2004 09:22 AM

Thanks, that makes sense.


All times are GMT -5. The time now is 11:04 PM.