LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-17-2004, 04:41 PM   #1
murray_linux
Member
 
Registered: Nov 2003
Distribution: Slackware Current
Posts: 210

Rep: Reputation: 30
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
 
Old 05-17-2004, 04:46 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

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

The same under both users?
 
Old 05-17-2004, 06:55 PM   #3
johnp
Member
 
Registered: Apr 2004
Distribution: Fedora Code 19
Posts: 30

Rep: Reputation: 15
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
 
Old 05-17-2004, 06:57 PM   #4
johnp
Member
 
Registered: Apr 2004
Distribution: Fedora Code 19
Posts: 30

Rep: Reputation: 15
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?

Last edited by johnp; 05-17-2004 at 07:00 PM.
 
Old 05-17-2004, 07:49 PM   #5
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 34
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...........
 
Old 05-18-2004, 02:34 PM   #6
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
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
 
Old 05-18-2004, 08:32 PM   #7
Nichole_knc
Member
 
Registered: Mar 2004
Location: Georgia
Distribution: SlackWare 10.1+, FreeBSD 4.4-5.2, Amiga 1.3,2.1,3.1, Windors XP Pro (makes a fair answering machine)
Posts: 287

Rep: Reputation: 30
see also
http://www.linuxquestions.org/questi...100#post941100
and copy your ~/.DIR_COLORS to the root home...
 
Old 05-18-2004, 08:33 PM   #8
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 32
Add this line to your root .bashrc:

alias ls='ls --colors=auto -hF'
 
Old 05-19-2004, 09:57 PM   #9
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 392

Rep: Reputation: 55
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.
 
Old 12-09-2004, 07:41 PM   #10
mooreted
Member
 
Registered: May 2003
Posts: 598

Rep: Reputation: 30
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?
 
Old 12-09-2004, 09:47 PM   #11
Genesee
Member
 
Registered: Dec 2002
Distribution: Slackware
Posts: 927

Rep: Reputation: 30
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?
you sourced .bashrc in .bashrc? I've never tried that, but as a wild guess that's part of the problem 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

Last edited by Genesee; 12-09-2004 at 09:51 PM.
 
Old 12-10-2004, 09:22 AM   #12
mooreted
Member
 
Registered: May 2003
Posts: 598

Rep: Reputation: 30
Thanks, that makes sense.
 
  


Reply

Tags
colors, console, dircolors, konsole, su



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost DHCP Lease when putting computer in "Standby" mode for a "long" time pnellesen Linux - Networking 1 01-06-2005 11:44 PM
"Anaconda" and "mini-wm" lost connection to display :1.0;??? cbrittain Fedora - Installation 2 03-14-2004 11:22 AM
"Anaconda" and "mini-wm" lost connection to display :1.0;??? cbrittain Linux - General 0 02-24-2004 05:04 PM
installed kde 3.2 and konsole colors lost true_atlantis Linux - Software 2 02-07-2004 03:42 PM
"mail" and "mailx" lost. yapp Slackware 2 10-27-2003 11:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration