Yesterday I've been experimenting with the "message command" line, but there is something you should be aware of.
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)
Cmnd_Alias WINPOPUP = /opt/sbin/winpopup.sh
samba your_hostname = NOPASSWD: WINPOPUP
And this line in /etc/samba/smb.conf:
message command = sudo -b /opt/sbin/winpopup.sh %m %s
If anything fails, you should see it in the samba log files.
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:
# 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
if [ ! -e "$2" ]; then
echo "$0: Can't open $2" >&2
# 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
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