Display different motd file based on group

Is it possible in ubuntu to print a different motd file based on the group of the user that is logging in?

I want to display different motd messages for admins and regular users when they login to my ubuntu 9.10 server.

I've looked at the PAM documentation and the documentation for the pam_motd module without any answers.


You're probably quicker adding a shell script onto the end of /etc/profile file to do a group check then spit out a message

Something like:

#!/bin/bash
# script at /usr/local/bin/motdcheck
PGROUP=`groups|awk '{print $1}'`
cat /etc/motd.${PGROUP}

would run as a script which outputs a file named /etc/motd.groupname where groupname is the first group in the users group list.

Everything in /etc/profile is ran each time a new login shell is opened.