[Eisfair] message from eisfair_Samba_Server

Thomas Bork tom at eisfair.org
Mo Dez 3 21:50:54 CET 2012


Am 03.12.2012 20:53, schrieb Marcus Roeckrath:

> Gut, es ist also der Parameter %f aus der smb.conf.

Zum Verständnis:

Es handelt sich hier erst einmal um eine Netbios-Nachricht, die ein 
laufender Samba-Server von _anderen_ Rechnern erhält. Diese Nachricht 
wird vom Samba-Server nicht abgewiesen, sondern per Mail an root auf dem 
_gleichen_ Rechner weitergeleitet.

Der Mail-Absender (nicht der Absender der Netbios-Nachricht!) ist somit 
immer gleich, wenn man annimmt, dass die Mails nur von dem einen Rechner 
abgeholt werden, da nur darauf ein Mailserver läuft.

Angenommen Server1 wurde als erster gestartet. Wenn nun Server2 startet 
und in dessen Samba-Konfiguration eine Netbios-Nachricht beim 
Samba-Start konfiguriert wurde, ermittelt Server2 die laufenden anderen 
Rechner mit Netbios-Server und versendet an die die Nachricht mittels

/var/install/bin/samba-netsend all

'all' filtert den eigenen Namen aus, damit man sich nicht selbst 
Nachrichten sendet.

Server1 gehört zu den ermittelten Rechnern mit Netbios-Server dazu, 
bekommt also von Server2 die Nachricht und leitet sie per Mail auf dem 
eigenen Rechner (Server1) weiter, wenn darauf ein Mailserver läuft.

> Vielleicht kann Thomas was dazu sagen, wie der belegt wird.

message command (G)

     This specifies what command to run when the server receives a 
WinPopup style message.

     This would normally be a command that would deliver the message 
somehow. How this is to be done is up to your imagination.

     An example is:

     message command = csh -c 'xedit %s;rm %s' &

     This delivers the message using xedit, then removes it afterwards. 
NOTE THAT IT IS VERY IMPORTANT THAT THIS COMMAND RETURN IMMEDIATELY. 
That's why I have the '&' on the end. If it doesn't return immediately 
then your PCs may freeze when sending messages (they should recover 
after 30 seconds, hopefully).

     All messages are delivered as the global guest user. The command 
takes the standard substitutions, although %u won't work (%U may be 
better in this case).

     Apart from the standard substitutions, some additional ones apply. 
In particular:

         %s = the filename containing the message.

         %t = the destination that the message was sent to (probably the 
server name).

         %f = who the message is from.

     You could make this command send mail, or whatever else takes your 
fancy. Please let us know of any really interesting ideas you have.

     Here's a way of sending the messages as mail to root:

     message command = /bin/mail -s 'message from %f on %m' root < %s; rm %s

     If you don't have a message command then the message won't be 
delivered and Samba will tell the sender there was an error. 
Unfortunately WfWg totally ignores the error code and carries on 
regardless, saying that the message was delivered.

     If you want to silently delete it then try:

     message command = rm %s

     Default: message command =

     Example: message command = csh -c 'xedit %s; rm %s' &

-- 
der tom
[eisfair-team]


Mehr Informationen über die Mailingliste Eisfair