1

I am amateurishly managing a shared Ubuntu server for our research group. I have installed many tools for my needs, which likely can be useful for others in my group, too.

How can I inform all other users all the installed software? Especially, when they first time log in and always let them know where to review the software list?

Is there any established way to handle this?

Some apparent approaches have unwelcome drawbacks:

  1. Just tell them vocally: This is not good. Tool list can be long and I will graduate some day.
  2. Leave a README: This is not ideal because ,for new students, they won't know its existence. They may see a README and mistakenly thought it's for something else and overlook it.
2
  • 1
    motd? – gronostaj Feb 25 '19 at 13:55
  • @gronostaj that's a good answer, I like it - expand it by showing how you add the motd and you've got a good answer there. – djsmiley2kStaysInside Feb 25 '19 at 15:01
2

When you connect to Ubuntu server, you're presented with a "Message of the Day" (MOTD) - and this is customizable.

Ubuntu builds the MOTD dynamically from a set of numbered scripts in /etc/update-motd.d. These are BASH scripts that run in order - so 00-header runs first, followed by the next numerically named script. For example, Ubuntu 16.04 has these files in /etc/update-motd.d by default:

  • 00-header
  • 10-help-text
  • 90-updates-available
  • 91-release-upgrade
  • 97-overlayroot
  • 98-fsck-at-reboot
  • 98-reboot-required
  • 99-esm

If you want to add a message between the header and the help text, create a bash script in a file named 01-custom-message and add your message.

When your users log in to the server, they'll see the message.

Here's an example script that displays a table of tools with links:

#!/bin/bash
# save this file as /etc/update-motd.d/01-custom-message

intro="Your Introductory message."
printf "%s\t"

divider===============================
divider=$divider$divider$divider
header="\n %-10s %-40s %-30s\n"
format=" %-10s %-40s %-30s\n"
width=80

printf "\n%s\n" "${intro}"
printf "$header" "TOOL" "DESCRIPTION" "URL"

printf "%${width}s\n" "$divider"

printf "$format" \
    "Tool1" "This tool is used for x." "https://example.com/tool1"\
    "Tool2" "This tool is used for y." "https://example.com/tool2"\
    "Tool1" "This tool is used for z." "https://example.com/tool3"

Alternatively you could create a reference page in HTML format on the server, and leave a reference to this (with a link) in the MOTD message.

From Ubuntu manpages:

MOTD fragments must be scripts in /etc/update-motd.d, must be executable, and must emit information on standard out.

Scripts should be named named NN-xxxxxx where NN is a two digit number indicating their position in the MOTD, and xxxxxx is an appropriate name for the script.

Scripts must not have filename extensions, per run-parts(8) --lsbsysinit instructions.

Packages should add scripts directly into /etc/update-motd.d, rather than symlinks to other scripts, such that administrators can modify or remove these scripts and upgrades will not wipe the local changes. Consider using a simple shell script that simply calls exec on the external utility.

http://manpages.ubuntu.com/manpages/trusty/man5/update-motd.5.html

3
  • Is there any type of GUI / "popup" motd, when you're not logging into a terminal? – Xen2050 Feb 26 '19 at 3:10
  • @Xen2050 You could use a Zenity pop up message for this. There's an answer here that may be useful: askubuntu.com/a/311352/463571 (GUI focused) or you could use the notify-send tool to pop up a basic temporary message. – csknk Feb 26 '19 at 10:48
  • Interesting, thanks. It doesn't look like MOTD itself could smoothly transition to use zenity / notify-send, instead of using printf, if so that would be convenient but it seems stdout & terminal focused. Or instead of relying on a user's own autorun file, it looks like something using pam & /etc/pam.d/login might work, in combination with zenity/notify-send. – Xen2050 Feb 28 '19 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.