GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - d-Rickyy-b/motd-files: The motd files I use on my servers

BranchesTags
Open more actions menu

Latest commit

 

History

29 Commits
29 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.gitattributes
.gitattributes
 
 
10-header
10-header
 
 
10-uname
10-uname
 
 
20-sysinfo
20-sysinfo
 
 
30-diskspace
30-diskspace
 
 
31-disktemp
31-disktemp
 
 
40-services
40-services
 
 
50-fail2ban
50-fail2ban
 
 
51-fail2ban_status
51-fail2ban_status
 
 
60-docker
60-docker
 
 
70-tls
70-tls
 
 
80-loggedinusers
80-loggedinusers
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
demo.png
demo.png
 
 

Repository files navigation

motd-files

This repository serves as a container for all of the motd files I use.

What is a 'motd'?

When you login to a system (e.g. via ssh), your system will prompt you with the message of the day (motd). Normally the text to be shown there is stored under /etc/motd but there was demand for dynamic motds. That's when the package update-motd became popular. The history of that is kinda weird and crazy, that's why you find a lot of confusing articles out there on how to set it up (which might be way outdated by now).

How to use it?

Setting up a dynamic motd is quite easy on a modern debian or ubuntu os. My reference is this great article written by @nachoparker.

If you have an up to date debian or ubuntu you can start right away. cd /etc/update-motd.d/ After opening that directory you can download/create your own motd script files there. One important thing: the scripts inside that folder will be executed in the order of their names (alphabetically) ascending. That means a script called "bar" will be executed before a script called "foo". That's why most of the scripts in that folder will have special names beginning with a double digit number such as "10-foo" and "20-bar" (that way you can have foo before bar).

Make sure you are root when you want to store files into that directory! Downloading the files is easy. Just open a GitHub repo, choose a script you want to download, click on "Raw" on the upper right side of the file and copy its link. Since we are inside the correct directory, we don't need to specify the -O parameter. wget https://raw.githubusercontent.com/d-Rickyy-b/motd-files/master/10-header

One of the most important steps is to make the files executable! chmod a+x 10-header

Now we are nearly finished. Go ahead and delete your current /etc/motd file with rm /etc/motd

If you now login to your system via ssh it should work just fine. If it does not, you might need to check your /etc/ssh/sshd_config server config. You must use PAM for this to work UsePAM yes. Also make sure to set PrintMotd no. Lastly you need to check if your /etc/pam.d/sshd (for ssh logins) and /etc/pam.d/login (local terminal logins) config file contains the following content:

# Print the message of the day upon successful login.
# This includes a dynamically generated part from /run/motd.dynamic
# and a static (admin-editable) part from /etc/motd.
session    optional     pam_motd.so  motd=/run/motd.dynamic
# session    optional     pam_motd.so noupdate

The motd=/run/motd.dynamic must be present. If it is not, add it. If both pam_motd.so motd=/run/motd.dynamic and pam_motd.so noupdate are present, PAM will first display the dynamically generated MOTD from /run/motd.dynamic, followed by the static MOTD in /etc/motd.

However, it's uncommon to use both unless you explicitly want both a dynamic and static MOTD.

Demo of the motd files

Here is a screenshot of the motd one of my servers

Screenshot

Troubleshooting

Most of these scripts parse some information from certain commands to display them. If your os is not set to english, the scripts might fail to parse the correct data. Also remember that all those scripts will be executed before your server starts your session & shell. That means the more work you do there, the longer it takes for your shell to appear. You can always use time /path/to/script to check the execution time of your script. Make sure all scripts together don't take longer than a second or you will have to wait for quite a long time.

If you have any questions, don't hesitate to contact me.

About

The motd files I use on my servers

Topics

bashdebianhacktoberfestmotdmotd-filessshubuntu

Resources

Readme
MIT license
Activity

Stars

35 stars

Watchers

1 watching

Forks

9 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.