We talked about MOTD in the previous article (it is quite important to open the link and read it, we will not repeat the same information in this article). The Banner Message Shown before is different and that also discussed.
The Banner Message Which Shows Memory usage & Other Useful Info By Default Can Be Disabled. Enable Ubuntu System Information After SSH Login. Here is How to Enable Ubuntu System Information After SSH Login. If you have this message after successful SSH :
1 | Last login: Sun Dec 20 19:42:57 2015 from 115.168.0.7 |
and want to change to this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.2.0-29-virtual x86_64) * Documentation: https://help.ubuntu.com/ System information as of Sun Dec 20 19:48:57 UTC 2015 System load: 0.08 Processes: 20 Usage of /: 11.4% of 300 GB Users logged in: 0 Memory usage: 1% IP address for eth0: 10.01.01.18 Swap usage: 0% Graph this data and manage this system at https://landscape.canonical.com/ 21 packages can be updated. 12 updates are security updates. |
this guide will serve that purpose.
---
Enable Ubuntu System Information After SSH Login : Packages are Not Installed
Web Hosts compile the distributions according to their need. Usually some packages are not installed to keep the Operating System lighter. If you run this command :
1 | landscape-sysinfo |
and that throws the error that packages are not installed, you have to installed them. If the command returns a right System Information, then also read ahead. The official manual pages are here :
1 2 | http://manpages.ubuntu.com/manpages/lucid/en/man5/update-motd.5.html http://manpages.ubuntu.com/manpages/wily/en/man1/landscape-sysinfo.1.html |
In case, you the landscape-sysinfo
command returned a right System Information but nothing coming after login, check these two files by running cat on them :
1 2 | cat /etc/update-motd.d/50-landscape-sysinfo cat /etc/update-motd.d/90-updates-available |
In case, the landscape-sysinfo
command returned the error that packages are not installed, then you need to run 2 commands or rather two packages. We suggest to run the commands one by one :
1 2 | apt-get install landscape-common apt-get install update-notifier-common |
Now, run :
1 | landscape-sysinfo |
It will take around 10 minutes for the scripts to be in properly informative condition. Reboot the server.
Enable Ubuntu System Information After SSH Login : Modification and Other Stuffs
The MOTD is generated from scripts and stuffs from these four places:
- Scripts in
/etc/update-motd.d/
- Compiled binaries controlled by
/etc/pam.d/login
/etc/legal
file/etc/ssh/sshd_configl
file
In the /etc/ssh/sshd_config
file, PrintLastLog controls the “Last login: …” message, it is quite complicated, not exactly setting it to No will vanish it. If you run cat
on /etc/update-motd.d/50-landscape-sysinfo
and /usr/bin/landscape-sysinfo
, you will see the coding part. We set for the MOTD using the /etc/landscape/client.conf
configuration file:
1 2 3 4 | ... [sysinfo] exclude_sysinfo_plugins = Memory ... |
We need to remove the advert :
1 | Graph this data and manage this system at https://landscape.canonical.com/ |
/etc/landscape/client.conf
should be owned by landscape
user for the settings to take effect. Not only /etc/landscape/client.conf
need to be owned by the user landscape
, it should belong to the group landscape
. Check by running ls -al
command. Run sudo chown landscape
like command to get the proper ownership. This is related to cloud-init.
In the /etc/landscape/client.conf
file, add lines these :
1 | [sysinfo] exclude_sysinfo_plugins = LandscapeLink |
If still, you can not get rid of that Graph this data and manage this system at...
, run this command to find the path of landscapelink.py
file :
1 | locate landscape | xargs grep Graph |
Take that, landscapelink.py
file is located at /usr/../../../../landscapelink.py
, open that file :
1 2 3 4 5 6 7 | ... def run(self): self._sysinfo.add_footnote( "Graph this data and manage this system at " "https://landscape.canonical.com/") return succeed(None) ... |
comment out :
1 2 3 4 5 | ... # self._sysinfo.add_footnote( # "Graph this data and manage this system at " # "https://landscape.canonical.com/") |
Run :
1 | sudo update-motd |
Other plugins related to /etc/landscape/client.conf
are :
1 | Load, Disk, Memory, Temperature, Processes, LoggedInUsers, LandscapeLink, Network |
If we remove more, we need to add by adding comma as separator :
1 | [sysinfo] exclude_sysinfo_plugins = LandscapeLink,Temperature |
We can test the look before editing :
1 | landscape-sysinfo --exclude-sysinfo-plugins=Temperature,LandscapeLink,Processes |
Editing /etc/update-motd.d/50-landscape-sysinfo
also will work, which by default is :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/sh cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null) [ "$cores" -eq "0" ] && cores=1 threshold="${cores:-1}.0" if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then echo echo -n " System information as of " /bin/date echo /usr/bin/landscape-sysinfo else echo echo " System information disabled due to load higher than $threshold" fi |
Definitely, you can edit it. If echo
like command can be executed, all normal commands can be executed. Always take backup of the default file, change by editing, then run :
1 | landscape-sysinfo |
to check before reboot or exiting SSH session. It can throw errors and freeze the system due to some security related bugs. Normal commands will not create any problem.
Just as extra information, Archey is a tool written in Python that allows users to preview system information along with your Linux distribution logo on the terminal. To install it, run :
1 2 3 | sudo apt-get install lsb-release scrot wget http://github.com/downloads/djmelik/archey/archey-0.2.8.deb sudo dpkg -i archey-0.2.8.deb |
The command which evokes it is archey
. That looks like this :

How you’ll use it that is your matter. screen fetch
is another such utility.