Send messages between 2 Ubuntu PCs (Net Send Style)
I read you wanted to do this without SSH, I believe I have a solution: netcat
[nc]
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: ./daemon.sh &
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
Then 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!
Install ssh
and 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"
Happy message-sending!
(or scaring XD)
Use 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).
You don't have to use port 3333, use any number between 1025 and 65535 inclusive.
Remember that this is not encrypted. Any computer on your network can see what text you're transferring.