issue* : affiché avant le login, visible localement sur les tty (ctrl+alt+f*), tous ceux qui ont accès à la machine peuvent le lire.
motd : affiché après le login, le message n’est destiné qu’à ceux qui sont dûment connectés.
$ man motd
[code]
NAME
motd - message of the day
DESCRIPTION
The contents of /etc/motd are displayed by pam_motd(8) after a successful login but just before it executes the login shell.
The abbreviation "motd" stands for "message of the day", and this file has been traditionally used for exactly that (it requires much less disk
space than mail to all users).
On Debian GNU/Linux, the content of /run/motd.dynamic is also displayed. This file is generated by /etc/init.d/motd at boot.[/code]
Rebondir sur les termes clés : pam_motd, login, /run/motd.dynamic, /etc/init.d/motd.
Il semblerait que tu puisses influer sur la teneur de motd de plusieurs façons en éditant /etc/login.defs, /etc/pam.d/login, /var/run/motd.dynamic ou /run/motd.dynamic.
Extrait de /etc/pam.d/login
# Prints the message of the day upon succesful login.
# (Replaces the `MOTD_FILE' option in login.defs)
# 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
motd=/run/motd.dynamic, voilà le fichier à éditer.
cat $MESSAGE_DU_JOUR >>/run/motd.dynamic
$ cat /etc/init.d/motd
#!/bin/sh
### BEGIN INIT INFO
# Provides: motd
# Required-Start: hostname $local_fs
# Required-Stop:
# Should-Start:
# Default-Start: 1 2 3 4 5
# Default-Stop:
# Short-Description: Create dynamic part of /etc/motd
# Description: /etc/motd is user-editable and static. This script
# creates the initial dynamic part, by default the
# output of uname, and stores it in /var/run/motd.dynamic.
# Both parts are output by pam_motd.
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
do_start () {
# Update motd
uname -snrvm > /var/run/motd.dynamic
}
do_status () {
if [ -f /var/run/motd.dynamic ] ; then
return 0
else
return 4
fi
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
do_status
exit $?
;;
*)
echo "Usage: motd [start|stop|status]" >&2
exit 3
;;
esac
:
stores it in /var/run/motd.dynamic,uname -snrvm > /var/run/motd.dynamic …
var/run/motd.dynamic : voilà le fichier à éditer.
cat $MESSAGE_DU_JOUR >>/var/run/motd.dynamic
Pour rendre la personnalisation de motd permanente, il faudrait ajouter les instructions au script/etc/init.d/motd.