10.3. Message to Users

10.3.1. Message to Everyone who Logs in

There is a program, xmotd - message-of-the-day browser that makes it possible to show the contents of a file when a user logs in to the system. This is useful, for example, when you want to give information about a new printer, planned down time, etc.

If you don't have xmotd installed, then you can install it with

apt-get install xmotd

Then you have to enable the program xmotd to be able to show a file when the user logs in.

Add these lines to the file /etc/X11/Xsession

xmotd  -popdown 25 -geometry 500x500 /usr/local/motd \
-xrm "*title.label: Today's Message"" -always
This will then show the contents of the file /usr/local/motd when the user logs in. -popdown 25 means that the message will disappear after 25 seconds, while -always means that the message will be shown every time a user logs in.

Have a look at the manual page for xmotd for a description of the other choices. You can view the manual page from the command line with the command man xmotd.

10.3.2. Message to a Specific User who Logs in.

Sometimes it's necessary&desirable to give a message to a specific user when they log in, for example when the user has used too much space on the hard drive. This is done by adding a few lines to the file /etc/X11/Xsession

if [ -e "/usr/local/message/$USER" ]; then
exec /usr/X11R6/bin/xmessage -file /usr/local/message/$USER &
By creating a file with the name klaus in the directory /usr/local/message/ then this file will be shown when the user klaus logs in.

10.3.3. Giving a Message to All Users That are Logged on


This has not yet been verified to work with Sarge.

If you have a machine where you have installed both main server and thin client server, then you can use a little Perl script to give a message to all users that are logged on.

#!/usr/bin/perl -w

if (@ARGV != 3){
        print "Use:\n\txwall.pl keyword time message\n";
        print "\t keyword is the word you search with\n";
        print "\t time is the time in seconds you want the message to be visible\n";
        print "\t message is the message, should be written inside quotation marks\n";
        exit (1);

$SIG{CHLD}="IGNORE"; # in the unlikely event a child exits before the parent

my ($procmatch, $timeout, $message) = ($ARGV[0],$ARGV[1],$ARGV[2]);

foreach $pid (split /\s/,`/bin/pidof $procmatch`) {
        my ($display, $xauthority, $homedir);
        foreach $envvar (split /\00/,`cat /proc/$pid/environ`){
                if ($envvar=~/DISPLAY=(.*)/){ $display = $1; }
        foreach $var (split /\n/, `cat /proc/$pid/status`){
                if ($var =~ /Uid:\s+?(\d*?)\s+?/) { my @uid = getpwuid($1); $homedir = $uid[7]; }

        if ($display){
                if (fork() == 0) {
                        $ENV{DISPLAY}=$display; $ENV{XAUTHORITY}="$homedir/.Xauthority";
                        exec("xmessage -center -timeout $timeout '$message'");
This script is then saved as xwall.pl and used in the following manner

perl xwall.pl alarmd 10 "Hi! You will see this message for 10 seconds."

Sometimes it can be a bit tricky to find a process that can be used as a keyword that covers all logged in users. I have had good experience with using the process alarmd as a keyword. Try the command ps auxw|grep alarm then you will see if this keyword works for you.

10.3.4. Automatic User Log In


This is not smart security-wise, but very nice if, for example, you have a Skolelinux/Debian-edu network at home and you are the only user. Be aware that the user in question will be able to log in without being asked to give a password.

It is possible to automatically log in a specific user on a specific thin client when it gets turned on. This is done in the file /etc/kde3/kdm/kdmrc where the following lines are added:

Here the user klaus gets automatically logged in to the thin client ltsp010 when it gets turned on. In order for this to work, you need to lock the MAC address to the IP-address.

In this case, the user test gets automatically logged in on the thin client ltsp058.

10.3.5. Automatic Input of Username in the Login Window

If you have a thin client placed where there is always one single user who logs in, such as in an office, it may be fine to set things up so that the user doesn't have to type in their username but just their password. You can do this by adding the following lines to the file /etc/kde3/kdm/kdmrc

That way the thin client ltsp059 has already filled in perbart as username; the only thing the user has to type in is his password. If some other user than perbart wants to use that thin client, they can easily do so by removing perbart from the login window and typing in their own username.