Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 15 down vote accepted

Install openSSH, and libnotify-bin (via terminal)

sudo apt-get install openssh libnotify-bin

on both computers.

Then SSH (via the terminal) into the other computer and when your logged in, type in:

ssh <user name>@<ip address>

and then when you're logged in, type:

export DISPLAY=:0.0
notify-send "Title of message" "message text"

Hope this works.

share|improve this answer
    
Even though this is a very intelligent answer am trying to find a way to send it without ssh. With the ssh option i already know it works (using wall for example) but your notify-send is very smart. –  Luis Alvarado Mar 23 '11 at 1:34
1  
After searching several methods this one is the best. Because of 2 reasons: 1. ssh gives me some security over doing this and 2. The use of DISPLAY allows to select to which video the message will show. I tested using ssh user@ip/domain 'DISPLAY=:0 notify-send "TITLE" "MESSAGE"' –  Luis Alvarado Apr 5 '11 at 17:00
    
It may work in a home enviorment, but in a large organisation, i am not sure if it is possible to install SSH on every client system, I have experience as in my office there are about 100 coms, there should be another way to send a message with out installing SSh –  The_skinny_man Oct 26 '11 at 5:25
    
Check out my answer for accomplishing this without ssh! :) –  Matt Oct 26 '11 at 6:05
add comment

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]

I see you already have accepted an answer for this question :( But if my solution works for you, please at least give me a Upvote! Thanks. Also, 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!

share|improve this answer
1  
I would actually give you 100 upvotes if I could. It is a very smart and easy way of doing it. +1 to you. –  Luis Alvarado Oct 26 '11 at 6:06
    
^_^ Thanks. I didn't expect you to "Accept" my answer, but I like answering these kind of questions [where I can use what I've learned the last few years on linux to help other people] so I answered it anyway. –  Matt Oct 26 '11 at 6:09
    
This is a neat solution, but I kinda prefer SSH because of security purposes. –  Jonathan Nov 23 '11 at 2:08
1  
Someone told me you can use socat instead of netcat, for SSL encryption. I never looked into it though. –  Matt Nov 24 '11 at 0:06
1  
Wow! nicely done! I changed it a bit to work with notify-osd: nc -l $port | while read msg; do notify-send "$HOSTNAME" "$msg" -i gtk-network; done –  Khurshid Alam Jun 4 '13 at 14:50
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.