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?


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;
  • This is how to generate a banner, not how to display it through an ascii only filter.
    – hildred
    Commented Jul 13, 2015 at 4:23
  • 1
    @terdon - feel free to move this A to this Q: unix.stackexchange.com/questions/215578/….
    – slm
    Commented Jul 13, 2015 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
    Commented Jul 13, 2015 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: unix.stackexchange.com/questions/109038/…. 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
    Commented Jul 13, 2015 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.

  • 2
    /etc/issue.net does not support ANSI color, however, /etc/motd does. Tested on Ubuntu 14.04 LTS and CentOS 6.X
    – est
    Commented Feb 8, 2017 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .