Yesterday I've been experimenting with the "message command" line, but there is something you should be aware of.
That example writes a message to /dev/console, but this node is protected against writing (off course). If you've tried that example, you might believe the samba message didn't work.
I've solved this with 'sudo'. (type visudo)
Code:
Cmnd_Alias WINPOPUP = /opt/sbin/winpopup.sh
samba your_hostname = NOPASSWD: WINPOPUP
And this line in /etc/samba/smb.conf:
Code:
message command = sudo -b /opt/sbin/winpopup.sh %m %s
If anything fails, you should see it in the samba log files.
edit:I've found 2 problems in the script that the example provides:
* the script doesn't stop when an error occurs
* the "cat $1" should be changed into "cat $2"
Here is my version:
Code:
#!/bin/sh
set -e
# Parameter 1 ($1) is the name of the machine sending the WinPopUp message
# Parameter 2 ($2) is the name of the file containing the message.
if [ -z "$1" -o -z "$2" ]; then
echo "Usage: $0 'user' 'temp-message-file'" >&2
exit 1
fi
if [ ! -e "$2" ]; then
echo "$0: Can't open $2" >&2
exit 1
fi
# Write the message to the console
echo "" > /dev/console
echo "Message from $1" > /dev/console
cat $2 > /dev/console
echo "" >/dev/console
# Delete the file with the message
rm $2
I'd been testing this script locally only, but it seams to work.
When I open a virtual terminal, and type "smbclient -M
myhostname", or "echo message | smbclient -M
myhostname", the message appears at the console