You are not logged in.

#1 2013-04-12 01:30:50

flash84
Member
Registered: 2011-10-16
Posts: 10

SSH motd system information

So i saw this cool thing on an ubuntu system which shows the system usage information on login as some sort of motd.
Googled something, and it looks something like this

bob@b-desktp:~$ ssh admin@192.168.0.151
admin@192.168.0.151's password: 
Linux bckppc.nnbob.net 2.6.32-27-generic-pae #49-Ubuntu SMP Thu Dec 2 00:07:52 UTC 2010 i686 GNU/Linux
Ubuntu 10.04.1 LTS

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/

  System information as of Mon Dec 27 17:18:52 CST 2010

  System load:  0.0               Processes:           98
  Usage of /:   11.8% of 2.54GB   Users logged in:     0
  Memory usage: 8%                IP address for eth0: 192.168.0.151
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/

No mail.
Last login: Mon Dec 27 17:00:10 2010 from b-desktp.nnbob.net

Is there a way to add this to an arch system? Right now, i have no idea how to add that to /etc/issue

Offline

#2 2013-04-12 04:11:09

pilotkeller
Member
From: Canada
Registered: 2011-12-22
Posts: 513
Website

Re: SSH motd system information

Well, you probably want to modify /etc/motd because PAM (/etc/pam.d/system-login) will automatically display this by default on successful logins (Including SSH).

As for the dynamic MOTD content, this is the work of a daemon that periodically rewrites the file. Something quite easily done with some shell scripting or Perl.

A better approach however would just be to write something for ~/.bash_login as this runs whenever you launch a shell and only runs the shell script when you open the terminal instead of all the time. You also get escape characters and variable substitution for free and it adds this banner only for yourself instead of all the system's users. If you use zsh it's ~/.zlogin instead.

Offline

Board footer

Powered by FluxBB