In this tutorial we will learn,how to set Message Of The Day ( motd ) on Linux systems. The motd abbreviation is “Message Of The Day”. The motd is widely used in Linux servers.
Uses of MOTD ( Message Of The Day )
As the name defines, the motd is used for displaying message when user login into the system.
You can display any kind of message on screen. Either it can be legal notice, information, planned outage, warning, alert or anything as per your requirement.
Absolute path of MOTD file
The absolute path of motd file is /etc/motd in Linux Operating System.
Set motd ( message of the day )
Setting motd in linux is very easy.You only have to edit the file /etc/motd and save it.
(There is no service associated with motd)
For eg. I am setting the motd with information, “Unauthorized access to this server is strictly prohibited !!”
Similarly,you can write any other message in /etc/motd file .
vi /etc/motd Unauthorized access to this server is strictly prohibited !!
Save the file /etc/motd .
Displaying motd to users accessing server by ssh
To display motd to users accessing by ssh method. We have to uncomment the PrintMotd parameter and make its value as yes in /etc/ssh/sshd_config file.
vi /etc/ssh/sshd_config PrintMotd yes
Now restart or reload the ssh service
# In Debian/Ubuntu /etc/init.d/ssh restart # In RHEL/CentOS/Scientific Linux /etc/init.d/sshd restart
How to verify is motd working ?
To verify the motd status, just log-out and relogin to system again .
Also, access the system via ssh for verifying, in case users login with ssh method.
Example 1: Accessing directly to server. The system is running in runlevel 3
Example 2: Accessing server via ssh