Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I would like to colorize my ssh banner. I know I can perform it like so:

In /etc/profile I can put:

echo -e "\e[1;31m Colorful text"
echo -e "\e[0m Reset"

But I have some ASCII art in the banner with special characters. Is there any way to colorize this without escaping every single special char in the ASCII art?

share|improve this question

2 Answers 2

You might want to have a look at toilet. The following has been incorporated in the banner of one of the servers at my lab:

enter image description here

You can install it on Debian based systems with

sudo apt-get install toilet

TOIlet prints text using large characters made of smaller characters. It is similar in many ways to FIGlet with additional features such as Unicode handling, colour fonts, filters and various export formats.

toilet works perfectly well with ASCII art:

enter image description here

I have written a little Perl script to highlight specific regexes in text. If you use . as the regex, it will color everything a specific color:

enter image description here

The script (use -h for a tiny help message):

#!/usr/bin/env perl
use Getopt::Std;
use strict;
use Term::ANSIColor; 

my %opts;
    if ($opts{h}){
    print "Use -l to specify the letter(s) to highlight. To specify more than one patern use commas.\n -i makes the search case sensitive\n -c: comma separated list of colors\n";
my $case_sensitive=$opts{i}||undef;
my @color=("bold blue",'bold red', 'bold yellow', 'bold green', 'bold magenta', 'bold cyan', 'yellow on_magenta', 'bright_white on_red', 'bright_yellow on_red', 'white on_black');
if ($opts{c}) {
my @patterns;
# Setting $| to non-zero forces a flush right away and after 
# every write or print on the currently selected output channel. 

while (my $line=<>) 
    for (my $c=0; $c<=$#patterns; $c++){
    print STDOUT $line;
share|improve this answer
This is how to generate a banner, not how to display it through an ascii only filter. –  hildred Jul 13 at 4:23
@terdon - feel free to move this A to this Q:…. –  slm Jul 13 at 4:52
@slm I won't have enough access to my machine for the next few days so I can't check. Are you saying that putting the output of toilet in etc/motd won't work? –  terdon Jul 13 at 11:51
@terdon - No it works for motd. hildred brought up that our A'ers won't work with SSH's banner function, given my answer to the this Q:…. Escape codes are disallowed in SSH's banner. So I made a Q to cover coloring MOTD's and moved my A'er over there. I figured you'd want to do the same w/ yours. –  slm Jul 13 at 12:10

Based on my research in this other U&L Q&A titled: Non-ASCII printable characters in sshd banner it is not possible to get SSH's banner facility to print the escape sequences necessary to colorize the output. This is in fact by design for security reasons.

Therefore it's impossible to print an SSH banner in this manner.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.