SEARCH

How-To Geek

Change SSH Welcome Banner on Ubuntu

Every time I connect to my Ubuntu development server through my ssh client, I receive the same message and I’m getting tired of seeing it, so I decided to change the message to something else.

Here’s the message that I get every time:

Linux superfast 2.6.20-16-generic #2 SMP Thu Jun 7 19:00:28 UTC 2007 x86_64

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

Last login: Mon Aug 13 01:05:46 2007 from ipaddress removed

geek@superfast:~$

Changing this message requires editing two different files. The first three sections can be modified by editing the following file:

/etc/motd

This file contains the linux build number as well as the Ubuntu warranty message. I don’t find this particularly useful, so I removed all of it and replaced it with my own message.

To disable the last login message (which I don’t recommend doing), you will need to edit the following file in sudo mode:

/etc/ssh/sshd_config

Find this line in the file and change the yes to no as shown:

PrintLastLog no

Now when you login, you’ll get a blank prompt, although I wouldn’t necessarily recommend it because it’s useful to see the last login to the system for security reasons. This is my prompt now:

This is a superfast system. Please max out the cpu accordingly.

Last login: Mon Aug 13 01:24:14 2007 from ipaddress removed
geek@superfast:~$

Linux is really great.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 08/12/07

Comments (22)

  1. Sebastian

    Nice HowTo and I agree: Linux rocks. :-)

    But if you want to avoid /etc/motd to be overwritten with the old version upon reboot you also have to edit /etc/default/rcS.

    Look for

    # Set EDITMOTD to “no? if you don’t want /etc/motd to be regenerated
    # automatically
    EDITMOTD=yes

    and change “yes” to “no” before editing /etc/motd

    Cheers
    Sebastian

  2. Kamahl

    My motd keeps resetting itself… I believe it might be the updates. Is there any way of locking the file after I’ve edited it?

  3. Sebastian

    If you are using Ubuntu, try editing /etc/motd.tail
    That will do the trick.

  4. Benny

    can i remove the “Last login: message?

  5. Dave

    Along the same lines you can uncomment the Banner /etc/issue.net line in /etc/ssh/sshd_config. Then put your message in /etc/issue.net and it’ll be displayed before you put in your password.

  6. Patrick

    If your banner keeps resetting itself, you need to keep in mind that /etc/motd is only a link to the /var/run/motd file. Edit that file to make the banner changes permanent.

    To remove the “Last login” message, edit your /etc/ssh/sshd_config file to change where it says:
    PrintLastLog yes
    to no, and you’re good to go.

  7. dMk

    Please take a look at https://wiki.ubuntu.com/UpdateMotd

  8. Stephen McConnell

    None of these work.

  9. Jeremy

    Stephen is right. None of these work. The following method worked for me in Ubuntu 10.04 and survived a reboot:

    Backup existing motd file, which is a symlink:
    sudo mv /etc/motd /etc/motd.bak

    Using your favorite text editor, create and open a new motd file (/etc/motd), edit the file as desired, and save. For example:
    sudo vi /etc/motd

    After editing the file, restart SSHD:
    sudo /etc/init.d/ssh restart

    Cheers,
    Jeremy

  10. Ian

    Thank you, Jeremy! That’s the only solution that worked for me.

  11. Bernardo

    That might still not work.
    To completely get rid of it use

    sudo mv /etc/update-motd.d /etc/update-motd.d.bak

    BE VERY CAUTIOUS USING THE LAST COMMAND
    make sure you are in the /etc/update-motd.d directory

    What this does is actually removing the scripts that generate the MOTD.

  12. hidon

    UBUNTU:
    echo ” > /etc/motd.tail
    or
    mv /etc/motd.tail /etc/motd.tail.bak

  13. dobila

    i have “no mail.” in my login screen, can you tell me how to delete it?

  14. wic

    What worked for me (on Ubuntu 10.10 Server) was editing /etc/update-motd.d/00-header to fit my needs, and a chmod -x 10-help-text to get rid of that part..

  15. nico

    thanks wic

    it worked fine for me !!

    good job.

    nico

  16. arodmon

    To delete completely the message logon:

    sudo mv /etc/update-motd.d /etc/update-motd.d.bak
    sudo mv /var/run/motd /var/run/motd.bak
    sudo touch /var/run/motd
    sudo mv /etc/motd.tail /etc/motd.tail.bak
    sudo vim /etc/ssh/sshd_config (Change: PrintLastLog yes -> PrintLastLog no)
    sudo vim /etc/init.d/ssh restart

  17. baditup

    that last line should probably be

    sudo /etc/init.d/ssh restart

    (without “vim”)

    just sayin’ =)

  18. Frank Malina vizualbod.com

    On Ubuntu 10.04, you can just:

    sudo rm /etc/update-motd.d/00-header /etc/update-motd.d/10-help-text /etc/update-motd.d/99-footer

    to get rid of the messages and keep the last login.

  19. John

    Here its one simple command that creates an empty hushlogin:

    > ~/.hushlogin

    DONE!!

  20. Vahid Pazirandeh

    For some reason on my Ubuntu 10.10 (server) I was not able to have the new files I made in /etc/update-motd.d appear in the MOTD, even with the proper execute permission. Instead I just modified one of the existing files.

  21. Sharly

    @Vahid – you’ll need to be sure you structure the file correctly. The files should be scripts, so be sure to add #!/bin/sh and echo statements, etc.

  22. David R

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!