Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How would one can send a message to the logged in user's desktop through ssh? I sometimes connect my friend's computer to help him out, but i need to the a message to his desktop rather than using talk or ytalk.

There are options like notify-send, gmessage, xmessage. But since I'm connected with SSH I cannot connect to their desktop.

Setting environment variable DISPLAY does not work as well.

How do I that?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Just setting $DISPLAY is not enough for xmessage since you don't have the needed authentication data for connecting to another user's X11 server – you would need to copy $XAUTHORITY as well. For notify-send, only $DBUS_SESSION_BUS_ADDRESS is required, but you will likely be denied access by the DBus policy.

Use this script to copy environment variables easily, and use sudo to run the command under your friend's account. For example:

pid=$(pgrep -x -u jon gnome-session)
sudo -u jon ./envcp $pid notify-send 'Hi'

(Instead of gnome-session any other process of that user can be used.)

share|improve this answer
    
seems a bit long way to use, i'll try to make a bash script for that –  Umur Kontacı Aug 31 '11 at 12:41

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.