I am trying to find a way to send a message (like a popup message) from 1 PC to another. both are using Ubuntu. Already tried the smbclient way but this only works between a linux PC to a windows PC. I need a way to send messages from an Ubuntu PC to another Ubuntu PC. Similar to the way of Windows Net Send.
libnotify-bin (via terminal):
sudo apt-get install ssh libnotify-bin
on both computers.
(You may have
libnotify-bin installed already. Mine had it already.)
Then SSH (via the terminal) into the other computer:
ssh <user name>@<ip address>
And then when you're logged in, type:
export DISPLAY=:0 notify-send "Title of message" "message text"
(or scaring XD)
I read you wanted to do this without SSH, I believe I have a solution:
It comes with Ubuntu by default.
First we need a "daemon" to run in the background. Second, we need a program to make the alert pop up. I have
zenity installed. If you do not, please install it, or edit the script to use whatever you like [e.x.
xmessage, but that is ugly]. Next, paste this into 'daemon.sh':
#!/bin/bash port=3333 nc -l $port | while read msg; do zenity --info --text "$msg"; done
Now, make it executable
chmod +x daemon.sh, now run it in the background:
Now you're done! Well, you actually need to do this on each computer. You also will want to automate the start of the daemon. Open the 'startup' applications from the menu, and add your script. Once that's done, to send a message to the other computer, type in:
nc 192.168.1.X 3333 then type your message and hit Enter. Each enter line will make a message pop up. To exit nc, press Ctrl +C, or Ctrl +D.
Just make sure to replace 192.168.1.X with the real local IP of the other PC. [You can use
ifconfig to find the IP address]
You could also make another script, say,
message.sh. In that, paste:
#!/bin/bash nc 192.168.2.X 3333
chmod +x message.sh. Then you can just type
./message.sh then type your message, then enter, and your message is sent. Also, now that I think of it, you could also add a sound notification. I would recommend
mplayer, it's a CLI media player. Shouldn't be too hard to figure out, but if you have any questions, please don't hesitate to ask!
nc to send text between two computers on the same network (without encryption).
On the receiving computer do
nc -l 3333
On the sending computer do
nc 192.168.1.XX 3333
then just start typing and the text will show up on the other computer (after you press enter) until you hit ctlr+c.
You can get the IP of the receiving computer with
hostname -I (run that on the receiving computer).
Remember that this is not encrypted. Any computer on your network can see what text you're transferring.