A Better Debian SSH Login Message

I’m a big fan of running Debian Linux on the server. To do a lot of administration it requires one to SSH into the machine. The default message displayed to the user contains a bunch of copyright information, which isn’t all that useful. Here’s an example of the default SSH MOTD on my server:

$ ssh tlhunter@nodebox
tlhunter@nodebox's password:
Linux 3.6.5-x86_64 #1 SMP Sun Nov 4 12:40:43 EST 2012 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Dec 22 13:38:52 2012 from crazy-hostname

Eww! The only useful information in this is the Kernel info, and the last login message. Surely we can do better.

First of all, to edit that message, you’ll want to edit the following file. Personally, I like the kernel information so I leave that in and delete all of the other lines.

sudo vim /etc/motd

Once that is done, we’ll want to add some commands to be executed once logging in. To do that, edit the following file:

vim ~/.bash_profile

Personally, I like to see who is logged in (to remind me if I have multiple sessions going), the uptime, the system CPU usage, and some statistics on my hard drives so I know if they’re full. To do all that, you just need to execute the following two commands (I throw in an echo for spacing):

Related Posts

Thomas is the author of Advanced Microservices and a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.