PDF download Download Article
Customize the MOTD and banner on your Linux box to welcome and instruct remote users
PDF download Download Article

It's easy to create your own welcome message for remote users who log in to your Ubuntu Linux machine via SSH. You can make a custom banner that displays before a user logs in, as well as one that displays after. Read on to learn how to create your own custom banners (even with ASCII art letters) in no time using Ubuntu!

Creating a Login Banner on Ubuntu Linux

  • To create a custom banner that appears before a remote user logs in, edit /etc/issue.net, add the path to /etc/ssh/sshd_config, and restart sshd.
  • To set up a custom banner that appears after login, edit or create a Message of the Day (MOTD) shell script in /etc/update-motd.d.
  • If you want to get creative with your banner, such as adding ASCII art letters, you can do so in the MOTD.
Section 1 of 3:

Creating a Welcome Message Before Login

PDF download Download Article
  1. This file contains the message that appears to remote users before they log in, just above the login prompt. Since this is a plain text file, you can edit it with your preferred text editor (like Nano or Vim) to create any custom welcome banner you wish.[1]
    • Use sudo to edit the file. For example, sudo vim /etc/issue.net.
    • /etc/issue.net is only shown to remote users. If you want the pre-login welcome message to be displayed to local users as well, edit /etc/issue instead, and delete (or rename) /etc/issue.net
    • By default, the file displays the current version of Ubuntu.
  2. Below the Ubuntu version, type the message you want to appear when remote users log in to the server.
    Advertisement
  3. To do so, use sudo vim /etc/ssh/sshd_config. However, the location of the SSH configuration file varies by Linux version and SSH version. If that file doesn't exist, try /etc/ssh/ssh_config or /etc/sshd/sshd_config.
  4. First, if you see a line in ssh_config that begins with #Banner, just remove the hash symbol to uncomment it. If not, scroll to the bottom of the file and create a new line beginning with the word "Banner," followed by the path to /etc/issue.net.
    • The new line (or uncommented Banner line) should look like this: Banner /etc/issue.net
  5. To do so, use the command sudo systemctl restart ssh.service. When sshd restarts, you can test your new banner by connecting to the server via SSH from a remote system.
  6. Advertisement
Section 2 of 3:

Creating a Message of the Day Banner After Login

PDF download Download Article
  1. To customize the banner that appears to remote users after they log in to your Ubuntu server, you'll need to edit the scripts in /etc/update-motd.d. Instead of using a single file, MOTD (Message of the Day) concatenates banner fragments from a series of scripts in this directory.[2] You can edit the existing scripts and create your own to appear along with them.
    • Use ls in /etc/update-motd.d to see the names of the scripts—notice that all begin with two numbers (00, 10, etc.). The number preceding each script's name determines the order in which it appears in the banner. For example, 00-header is the first part of the banner, and all subsequent numbers appear after it in order.
    • To see your current MOTD banner, use the command run-parts . to run all scripts in the directory.
  2. By default, you'll find 00-header, 10-help-text, 50-motd-news, 91-contract-ua-esm-status, 91-release-upgrade, and 92-unattended-upgrade, all of which are combined into a single banner message in that order. Other packages may also add their own scripts. You can edit these scripts individually by opening a script in your text editor with sudo.
    • Unlike the welcome message you can create in /etc/issue.net that appears before login, these files must be shell scripts—not plain text files.
  3. To do this, you'll want to create a new file beginning with a two-digit number representing where it should appear in the banner. For example, if you want your new addition to appear just beneath the header, you might call it 01-my_custom_msg.
    • Remember, this must be a shell script, not plain text.
    • After creating your script, make it executable so it can run. Use chmod +x <filename> to do so.
    • To remove a script from the banner, make it non-executable.
  4. To do this, use the command run-parts . to run all scripts in the current directory. The banner you see here is now what remote users will see when they log into the Linux server.
  5. Advertisement
Section 3 of 3:

Adding ASCII Letters to MOTD

PDF download Download Article
  1. If you're not up for creating your own ASCII art from scratch, you can use an ASCII text generator.
  2. To do this, create a new file in the directory that begins with two numbers so the message appears where you want it in the script. For example, to make it appear after 10-help-text, you might call it 11-ascii.
    #!/bin/sh
    
  3. This will likely take up several lines in the file. You'll also need to format the art so that it is echoed to the screen. Here's an example:
    echo "            _)   |    _)   |     |                        "
    echo "  \ \  \   /  |   |  /   |    __ |     _  \  \ \  \   /  "
    echo "   \_/\_/ _| _\_\ _| _| _  |  \___/   \_/\_/   " 
    echo ""
    echo ""
    
    • However, some characters need to be escaped, or the shell will think they are commands. In our example, we'd actually need to escape all backslashes (\) and pipes (|) in the art by placing a backslash before each. But don't worry—the added slashes won't appear in your banner.
  4. When you're finished editing, you'll need to use sudo chmod +x <filename> to give your script execute permissions. This ensures your banner will appear with the others in /etc/update-motd.d. You can test your new banner using run-parts ..
  5. Advertisement

Expert Q&A

Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Tips

Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement

About This Article

Nicole Levine, MFA
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 90,547 times.
How helpful is this?
Co-authors: 14
Updated: August 9, 2024
Views: 90,547
Categories: Linux
Thanks to all authors for creating a page that has been read 90,547 times.

Is this article up to date?

Advertisement