Nested SSH Session Inside Screen Has No Color – Solutions

byobucolorsgnu-screenputtyssh

I am attempting to keep a nested ssh session inside of a byobu/screen window, which I also connect to over SSH with Putty on Windows.

However the nested SSH session has no color. Here's what I'm talking about:

Lack of color

On the left you have byobu connected to wreckcreations with no color. On the right you have Putty connected directly to wreckcreations with color. Note that normally byobu has color when working locally.

I tried messing with $TERM, $PSI, and other variables to no avail. Any idea's what would cause this?

Best Answer

It could be many things.

Please provide the output of:

echo $TERM
echo $LS_COLORS
typeset -p LS_COLORS
alias ls
tput setaf 1 | od -c
echo "$(tput setaf 1)red$(tput sgr0)"

Expected results:

xterm (optional, see below)
no=00:... (or similar, should not be empty)
declare -x LS_COLORS="no=00:..." (ditto)
alias ls='ls --color=auto' (or similar)
0000000 033   [   3   1   m
0000005
red (in red)

My guess: TERM is set to something unusual, and dircolors doesn't know about it, therefore ls doesn't know what colors to use.

If this is the case, running the above commands inside your byobu/screen session, you would see:

screen (or screen-something)
(nothing)
(nothing)
0000000 033   [   3   1   m
0000005
red (in red)

Confirm that this is the case by running:

dircolors -p | grep "^TERM $TERM$"

I would expect it to print nothing.

The simplest fix, depending on your configuration, would be:

dircolors -p > ~/.dircolors
echo "TERM $TERM" >> ~/.dircolors
Related Question