Making It Your Web

Change SSH Welcome Banner On Ubuntu

by Alex Hall (on 3rd Jul 2013 @ 14:34:28)

  • 0 paragraph notes

So, here's a bit of fun. How do you change the welcome banner when you log on to Ubuntu via SSH? Well, it's not quite as straightforward as I first thought...

As root, if you nano/vi/editor of choice /etc/motd you can see the current message of the day (motd - ta-da!) and can edit this file to your hearts content to change it. However, the caveat is that on most systems this file gets re-created when you log in as there are some other scripts that run to actually write the file on log in. So, how do you change it?

Well, it's fairly easy. Firstly, cd into /etc/update-motd.d and list the directory (ll, ls -la). You should see one or more files starting with a number. For example, I have 00-header, 10-help-text and 99-footer. What happens is, when the SSH session starts, this list gets read and anything that is readable by the server gets read and dumped into that /etc/motd file. What I decided to do was only run what I wanted to run, that is, my own file. However, when the server gets upgraded it is quite possible that these files all get re-created so if you make changes to them they may well be lost.

read post