32

Sometimes we need to send a message to a remote user. We can display messages on our local desktop using Notify OSD, but we are unable to send a message to the remote user's desktop.

We tried the following:

ssh user@remote   
notify-send message

-> Sends message to the local display but not to the remote.

ssh admin@remote
sudo -u user "notify-send message"
sudo: notify-send user: command not found

-> There was a command not found error.

ssh -X user@remote "DISPLAY=:0 notify-send message"

-> Again sends the message to my local box only.

Is there any way to send a message to the remote desktop?

50

Have you tried

ssh user@host 'DISPLAY=:0 notify-send "TEST MESSAGE."'

Answer taken from ubuntuforums.org/showthread.php?t=1240828 (without the -X option as suggested by jjmontes)

  • 2
    -X is not needed since we are not forwarding the X protocol, but instead enforcing DISPLAY=:0 which is local to the remote host. – jjmontes Jul 28 '15 at 9:33
  • 1
    @jjmontes I tested it and you're right. Fixed. – hytromo Aug 21 '15 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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