Changing the welcome message in SSH

on Thursday, December 18th, 2008 at 1:57 pm

If your a linux user or maybe a simple linux server administrator with some servers at hand, the chances are that you use SSH to login there and manage them.

When a user logs in to SSH usually he sees a welcome message.
If you have an ubuntu machine like me then you will see the following message

Linux jo-desktop 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686

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.

To access official Ubuntu documentation, please visit:

http://help.ubuntu.com/

In order to change this message just type in the terminal

sudo vi /etc/motd

Screenshot

Update:
Note: On restart your changes to /etc/motd will be reverted, the reason is that /etc/motd is a symbolic link to /var/run/motd which is rebuilt by /etc/init.d/bootmisc.sh from a template, /etc/motd.tail, at each reboot. (thank you Adam Trickett).

jo@jo-desktop:/etc$ ls -l motd
lrwxrwxrwx 1 root root 13 2008-11-27 14:18 motd -> /var/run/motd
jo@jo-desktop:/etc$

This means that to make your changes permanent you can either:
1. change

/etc/motd.tail

then reboot

2. point the /etc/motd symlink to a different file such as /etc/motd.static and make your changes there. (Also thank you Adam Trickett).

Joe

10 Comments »

Thank you so much Jo, this makes us feel really at ~, i mean at home :)

One more tip, if anyone would like to have a cute design, just follow this link :
http://www.google.com/search?q=ascii+images

Cheers !!

Comment by ili | December 19, 2008 @ 1:04 am

and to get a prompt before you login (banner while logging in)…….
modifiy /etc/ssh/sshd_config
add or uncomment the line: Banner /etc/banner
Edit /etc/banner
restart ssh

et viola……you have a banner login screen for ssh

Comment by loren | December 19, 2008 @ 1:24 pm

Your suggestion is a bit simplistic, you probably shouldn’t bother with the /etc/motd file, rather you need to tinker with /etc/motd.tail instead.

Have a quick read of the man pages for motd and motd.tail

From the Debian notes:
5.15 Message of the day

/etc/motd is now a symlink to /var/run/motd which is rebuilt by /etc/init.d/bootmisc.sh from a template, /etc/motd.tail, at each reboot. It means that changes made to /etc/motd will be lost. Changes made into /etc/motd.tail are not automatically applied to /etc/motd other than at reboot.

Also, the EDITMOTD variable at /etc/default/rcS no longer has any effect. If you wish to disable updating of the motd, or want to maintain your own content for the message of the day you just have to point the /etc/motd symlink to a different file such as /etc/motd.static and make your changes there.

Comment by Adam Trickett | December 19, 2008 @ 1:50 pm

@Adam:
Thank you Adam for your comment, actually you are right but i rarely restart my server :) and what i wrote about above was just a simple suggestion.

Thank you again for your comment. I will update the article with your useful info.

Comment by Jo | December 19, 2008 @ 2:23 pm

Not to be picky, but motd displays for any login terminal, not just an SSH session. Xterm, telnet, etc. will all see the the message.
Just my little contrib.

Comment by Keith Pickett | December 19, 2008 @ 4:08 pm

Here’s my banner…

rock on man… only if your an authorized user, otherwise get lost!

___ _____
.’/,-Y” “~-.
l.Y ^.
/\ _\_ “Doh!”
i ___/” “\
| /” “\ o !
l ] o !__./
\ _ _ \.___./ “~\
X \/ \ ___./
( \ ___. _..–~~” ~`-.
` Z,– / \
\__. ( / ______)
\ l /—–~~” /
Y \ /
| “x______.^
| \
j Y

Comment by Paul Orama | December 19, 2008 @ 5:57 pm

Yes, really nice. I used to change /etc/motd and it used to survive a boot, until I noticed that somewhere, somehow it didn’t anymore, just because /etc/motd was apparently changed into a symlink. At that time, I did not investigate this because of it’s low priority, but now it is fixed. Thanks!

Comment by markba | December 19, 2008 @ 9:40 pm

Very cool!

Comment by Bill Bray | December 20, 2008 @ 10:33 am

you are very cool please send me your email joe (rmgazelle@hotmail.com) is my email by or good night

Comment by ramona | January 28, 2009 @ 12:45 am

A rolling stone is worth two in the bush, thnaks to this article.

Comment by Joyce | July 7, 2011 @ 7:50 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment