How to change message of the day on Ubuntu
Large | Medium | Small
The motd will look something like this:
Linux cazoodle 2.6.32-23-server #37-Ubuntu SMP Fri Jun 11 09:11:11 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.04 LTS
Welcome to the Ubuntu Server!
* Documentation: http://www.ubuntu.com/server/doc
System information as of Mon Jul 19 07:02:14 ICT 2010
System load: 0.99 Memory usage: 48% Processes: 150
Usage of /home: 34.4% of 275.02GB Swap usage: 0% Users logged in: 0
Graph this data and manage this system at https://landscape.canonical.com/
In order to change the message of the day, we first want to edit the file “/etc/motd.tail”. You might have noticed that this file does not contain all the information you was presented with when you logged in, and you might also have noticed the “motd” file in the same folder. The “/etc/motd” file is where all this information is gathered and the actual file presented to you. So if you want a one-time change to your motd that will be reverted on reboot, you can edit the “/etc/motd” file.
I am not sure if I changed something, but after I had edited the motd.tail file, the system information was no longer being updated. In order to turn it back on, I had to enable the motd updates with the following command: “update-motd –enable” (this means you can’t update the “/etc/motd” file though, as it will be overwritten fairly recently). There is a cronjob attached to this updating, which updates every 10 minutes. If you do not want the system information, you might want to remove this (it is installed at: “/etc/cron.d/update-motd”).
If you do want the system information, you might not want to display the last line of text saying:
This is fairly easy to remove. Open the file “/usr/lib/python2.5/site-packages/landscape/sysinfo/landscapelink.py” and find the following three lines:
self._sysinfo.add_footnote(
“Graph this data and manage this system at “
“https://landscape.canonical.com/”)
And comment them out like this:
# self._sysinfo.add_footnote(
# “Graph this data and manage this system at “
# “https://landscape.canonical.com/”)
This looks pretty good, but you might notice that if you boot the server and log in right away, there are no system information. This is because the cron job haven’t had a chance to run yet. Luckily, it is something we can solve.
Go to the folder “/etc/rcS.d/” and find the file called “Sxxbootmisc.sh”. The x’s in bold are a value, but the exact number varies – for instance, on two of my computers it is S80bootmisc.sh and S55bootmisc.sh. This file is run when the computer boots. When you located it, open it. Scroll through it until you find a line saying “# Update motd”. Here you can add the following line: “/etc/update-motd.d/50-landscape-sysinfo >> /var/run/motd”. This will make the system information be updated and added to the motd file when the computer boots.
The file mentioned above (50-landscape-sysinfo) might also be worth to look into, though it does not give many options for editing, but it would be possible to add a command such as “uptime” to what is shown.
When you log in through SSH, besides showing the motd, it will also tell you the last login to the server. Should you want to turn this line off, this is done in the file “/etc/ssh/sshd_config” where you change the line:
to
Simple as that.
How to add user to sudoers list
VIM Editor Commands
What does the star after a file name mean?
How to Keep Your SSH Session Running when You Disconnect
Installing Tomcat 6 on Ubuntu
How to list all groups that your Linux user belongs to
How to Mount a Remote Folder using SSH on Ubuntu
Linux user management commands
How to auto shutdown your computer in Linux
How to auto shutdown your computer in Linux
Linux user management commands
