LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-10-2009, 11:26 AM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Broadcasting Messages Across a Network


I want to broadcast messages across my local (home) network. Nothing fancy. As my primary interface is the GUI desktop, I'd like to see the messages in any X desktop and not just consoles and terminal windows.

For example, when any system in my network powers down or reboots, I'd like the shutdown warning message to broadcast to all systems on the network. As far as I can tell, the shutdown/reboot message broadcasts to all local logins on a system --- including any SSH logins, but not to the network.

I have played a bit with the wall (write all) command. Yet once again, this seems to be of local use only.

I read some about rwall (remote wall), but I am lost what should be used for the net-group variable and how to configure rwall. I am not even sure rwall is the correct solution. All I really want is all stations to see a shutdown/reboot message or any other message I might want to broadcast, whether working on a command line or in a GUI desktop.

I have been unable to find clear answers to the following questions:

1. How do I send the shutdown/reboot broadcast message to all stations on the LAN?

2. How do I send any message across the network?

3. KDE has a useful service called KDE Write Daemon that intercepts write and wall messages. The user receives a crude looking but effective pop-up containing the message. Yet once again, as the service intercepts write and wall messages, this seems to be limited to each local machine. Is there a way to receive messages across the network?

3. Does Xfce have an equivalent tool to the KDE Write Daemon?

Thanks again.

Last edited by Woodsman; 01-07-2010 at 12:37 PM.
 
Old 12-10-2009, 12:09 PM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Maybe you can have a look at talk.
Code:
man talk
That seems to be able to message across the LAN to users on other systems (depends on hosts file to find the remote systems). Don't know if there's a graphical version of it though. Google turned up quite a few when searching for LAN messenger Linux.

Kind regards,

Eric
 
Old 01-07-2010, 01:13 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Bump.
 
Old 01-07-2010, 01:24 PM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi Woodsman,

Have you given talk a try? If so what where your findings? Or do you need something with more/other functions/possibilities?

Kind regards,

Eric
 
Old 01-07-2010, 06:32 PM   #5
GooseYArd
Member
 
Registered: Jul 2009
Location: Reston, VA
Distribution: Slackware, Ubuntu, RHEL
Posts: 183

Rep: Reputation: 46
I'd use ssh:

echo "message" | ssh walluser@host wall

A nifty feature of ssh is that the authorized_keys file can constrain commands for a particular key, so you could have an account on each system with an authorized_keys file like:

command="/bin/wall" 1024 37 1440913682374...

Then you can load the corresponding key into an ssh-agent on the machine that will sending the notices. Even if the key were compromised, it'd only be good for sending annoying messages on the remote machines
 
Old 01-07-2010, 06:54 PM   #6
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
I probably am missing the big picture, but I don't know how talk will help broadcast system messages across a network. As I mentioned in my original post, the shutdown command broadcasts its message to all users on the machine, but not to the network. How do I make that happen?

All of these tools seem limited to local machines.
 
Old 01-07-2010, 08:49 PM   #7
lumak
Member
 
Registered: Aug 2008
Location: Phoenix
Distribution: Arch
Posts: 799
Blog Entries: 32

Rep: Reputation: 111Reputation: 111
@ Woodsman

It appears "wall" would be a good option if you have a lot of users on all your machines... But that requires SSH as described by GoosYard

"talk" appears to be for back and forth messaging (use <usrname>@<host>)

"write" appears to be local only so wall would be a better option...


As for sending a gui message, xmessage will work.

try:
Code:
DISPLAY=<your ip number>:0 xmessage hello
Assuming you have the right permissions to do so on the host, that should work over your network. I don't have two linux computers right now to test it... BUT I would suspect that you would need to do something with the inet deamon, ssh settings or editing the /etc/hosts.allow

OF COURSE you would have to run all this stuff from a script file.

If say the power button is hit or a UPS toggles it off, you would have to run the scripts from those settings.
The power button setting can be found in the /etc/acpi/acpi_handler.sh script.

You would need a list of hosts for your network that the script would beable to use to send the messages to. Or you could blindly send to all IPs on the network and end up with a lot of errors and wasted network trafic

Last edited by lumak; 01-07-2010 at 08:57 PM.
 
Old 01-08-2010, 05:28 PM   #8
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
I'm still missing the big picture.

All of the ideas offered require manual intervention on my part. Or I would need to write some kind of wrapper script to the shutdown command in order to broadcast the shutdown message across a LAN.

I don't think broadcasting messages through an SSH tunnel is the way to go. All I want is for all users on my LAN to see the shutdown message that is issued locally by the shutdown command.

If a remote user is in X then some kind of graphical pop-up should appear. If the user is in a console then a message should appear there.

Seems that the maintainers of the shutdown command remain stuck in the mainframe mode of thinking when all consoles were physically connected to the mainframe. In today's multi-networked world, that model is not always useful. When I reboot or halt a server machine in my LAN, I want that message broadcasted across the LAN, not just to users connected directly to the machine.

Is there a way to do this?
 
Old 01-08-2010, 05:37 PM   #9
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by Woodsman View Post
Is there a way to do this?
A word of advice: if you need this so badly, why don't you implement it yourself? Then share it with the rest of the networked world.

Eric
 
Old 01-08-2010, 05:50 PM   #10
GooseYArd
Member
 
Registered: Jul 2009
Location: Reston, VA
Distribution: Slackware, Ubuntu, RHEL
Posts: 183

Rep: Reputation: 46
Quote:
Originally Posted by Woodsman View Post
I'm still missing the big picture.

All of the ideas offered require manual intervention on my part. Or I would need to write some kind of wrapper script to the shutdown command in order to broadcast the shutdown message across a LAN.
If the machine is shutting down, it'll be changing to runlevel 0, and its trivial to add some action triggered by the edge of a runlevel transition. You can use either /etc/rc/rc0.d, or fool around with the inittab file.

ssh is ideal because its trivial. wall and xmessage already do exactly what you need, you simply need to invoke them remotely. The only other alternative is to write yourself some daemon that accepts a message over a socket. You'd be reinventing ssh and wall. And you're still going to have to solve the runlevel 0 puzzle anyway.
 
Old 01-08-2010, 09:05 PM   #11
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
Heres a few ideas. You can use netcat to bradcast a message over the lan and netcat to listen for messages on a port. For example on the server have this in a rc.shutdown script - say your ip address on the server is 192.168.1.10 then this will broadcast to all clients on the 192.168.1.1/24 network:
Code:
echo "!!! SERVER SHUTTING DOWN NOW !!!! " | nc -w1 -u -b 192.168.1.255 10000
In a termainal on the clients you just have this running :
Code:
nc -l -u -p10000
to collect the message. This will broadcast the message via UDP to the 192.168.1/24. You will have to write bits of bash/whatever around this but the basis is there. You could easily write a script to do things when this happens.
I don't know of any COTS ready to roll solutions for broadcasting messages in this way - I'm sure there are some though - there may be IM programs to do what you want.
 
Old 01-08-2010, 09:59 PM   #12
lumak
Member
 
Registered: Aug 2008
Location: Phoenix
Distribution: Arch
Posts: 799
Blog Entries: 32

Rep: Reputation: 111Reputation: 111
Uhhh... to always have netcat listening on an open port? I would trust wall and xmessage over that.


Regarding what GooseYArd said...
Yeah... setting up ssh and a blank unprivlaged user on all the mashines with 2 lines of code in the rc0.d would probably be the best. Just make sure to place it before all the services are shut down

@ Woodsman

So basically, yes the tool(s) already exist! It just takes a lot of ssh and user set up with 2 lines of code in rc0.d

Last edited by lumak; 01-08-2010 at 10:03 PM.
 
Old 01-08-2010, 11:15 PM   #13
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
As for sending a gui message, xmessage will work.
Yes, the tool will work, but like so many nominal X tools, is butt ugly. Further, the tool does not seem to work across a LAN.

I found some GUI tools like kpopup and linppopup. They are old or unmaintained and they are narrowly focused on running with Windows networks, as a replacement for WinPopup.

Quote:
If the machine is shutting down, it'll be changing to runlevel 0, and its trivial to add some action triggered by the edge of a runlevel transition. You can use either /etc/rc/rc0.d, or fool around with the inittab file.
Yes, I had contemplated that the solution probably would involve editing one of the shutdown scripts or writing a wrapper script of some kind. In perspective, I was running the simple network-capable WinPopup on Windows 3.11 in the early 1990s. I'm surprised there is no widely discussed method to extend system messages across a LAN. There does seem to be a solution, but overwhelmingly most of the solutions I have seen focus on creating messages isolated to a single workstation.

With that all said, today I tested sending a message with rwall. The process does work. I received a graphical message at a remote workstation while using KDE (because I had the KDE Write Daemon enabled). I also received the same message at the remote workstation for a concurrent console login.

For rwall to succeed the system expecting to receive messages must have /usr/sbin/rpc.walld running. That daemon receives messages and relays those messages as a local message using wall. Therefore, editing rc.shutdown would provide one way to broadcast a shutdown message.

From what I understand, rwalld normally is run from within inetd.

There is an associated file named /etc/netgroup. Rather than try to send a network message by individual host name, the -n command switch can be used and the systems listed in /etc/netgroup will receive the message.

I haven't yet figured out how to broadcast a message across a LAN using the /etc/netgroup file. The version included with Slackware does not seem to support the -n switch. At least I could not get that option to work and the man page does not address that option. I'd be happy to hear from anybody who gets that feature to function correctly on Slackware.

A caveat to all of this is if the receiving machines do not have rwalld running then the result is an error message.

Related to that idea is a tool called rwho, which depends upon the rwho daemon (rwhod). If the rwho daemon is running, the rwho command should return who is logged on across a network. That would provide one way to know who should receive a shutdown message from a server. That would provide an alternate method to /etc/netgroup not working. I haven't yet figured out the nuances of those commands because when I tested today, one machine reported users logged in at another system but a second machine reported only local logins. On the other hand, perhaps the problem is only some initial latency with gathering data because later both machines correctly reported all logins. If I understand correctly, the rwho mechanism succeeds only if the rpc.walld is running.

To continue my original post, I haven't yet discovered any unique graphical tool that will provide nice looking messages in KDE. The resulting popup from the KDE Write Daemon is crude although functional. Second, as I am not an Xfce user, I don't know how Xfce users would receive an equivalent graphical popup. Please share for future users if you know a way.

Quote:
You can use netcat to br[o]adcast a message over the lan and netcat to listen for messages on a port.
Quote:
Uhhh... to always have netcat listening on an open port? I would trust wall and xmessage over that.
Clever. I like the simplicity in which netcat could send a message, but I agree I would not want a terminal window running all the time to receive the message. Also, the wall method seems a better method for KDE to intercept.

Quote:
A word of advice: if you need this so badly, why don't you implement it yourself? Then share it with the rest of the networked world.
Eric, sometimes your attitude is condescending and disrespectful. Just because you get to work with computers all day long for a living does not mean the rest of us are gurus or have the same amount of time to tinker all day like you. There are folks here trying to help each other. I'm not a carpenter yet I built my own home. Not completely by myself because I did not possess all the required knowledge or equipment, and often I needed more than two hands. The same approach applies to computers --- sometimes people need additional knowledge or equipment, and sometimes they need more than two hands (or two heads).

Oh, and I believe I just did share a solution.
 
Old 01-09-2010, 01:20 AM   #14
lumak
Member
 
Registered: Aug 2008
Location: Phoenix
Distribution: Arch
Posts: 799
Blog Entries: 32

Rep: Reputation: 111Reputation: 111
Neat, thanks for pointing out rwall. I personally didn't search that hard to find out if there was already a remote wall version.


The "Simple" solution would be to hack the rwalld daemon and tell it to also use a gui message box when it sends the wall command... but that's messy.


Oh, you might want to take a look at Zenity and Notify-send for the gui portion if xmessage is too ugly.

Last edited by lumak; 01-09-2010 at 01:27 AM.
 
Old 01-09-2010, 02:35 AM   #15
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
IP Messenger may be what you are looking for:
http://www.ipmsg.org/index.html.en
You'll still need to hack the local sutdown script to call it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Broadcasting messages to others while hiding sender mjg82 Linux - Newbie 1 11-20-2008 03:58 PM
how to stop network connection messages? zero79 Debian 8 11-04-2004 09:51 AM
Network error/Info messages l2g Slackware 1 06-08-2004 01:58 PM
Sending messages across a network... kierl Linux - General 3 04-07-2003 01:11 PM
Broadcasting Server Messages to the network. mikeyt_333 General 3 06-13-2002 07:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration