Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My wife is sitting at her home desktop, alpha, which is running a recent version of Ubuntu. I am on a bus, using ConnectBot on my G1 phone, and can SSH into alpha from wherever I am.

For complicated reasons, I cannot use IM, email, or the telephone in order to contact her. (E.g. I don't want to wake the baby, my IM client is broken, my email server is down.) My only option is to ssh into alpha remotely and try to somehow make something appear on the screen. She's using KDE; how can I make something pop up to get her attention and let her know I'm trying to communicate with her? I thought it was possible to remotely trigger something (like xmessage) to appear on her screen even though my SSH session doesn't have an X display.

EDIT: To clarify, my phone is not running any flavor of X, so X-over-ssh is not possible. Would the following work?

$ export DISPLAY=:0
$ xmessage "test"
share|improve this question
    
Send an text message to a phone in silent mode... or is it just me? –  Nivas May 13 '11 at 16:41
    
Related question: is there a command to list all open displays on a machine –  nobar Feb 1 '12 at 0:10

4 Answers 4

up vote 20 down vote accepted

You can tell an X program which display to use with the DISPLAY environment variable, as long as you know which display alpha is currently showing. Almost certainly the only display is :0, unless you've manually fiddled with it, so if you run:

$ export DISPLAY=:0

Then any X applications you run will be displayed on alpha's monitor. xmessage is a good choice for showing messages; there's also xdialog. If you have libnotify installed, you can use notify-send to popup a message in the corner of the screen:

Example

share|improve this answer
    
Excellent options, thanks. I'll accept the answer as soon as the dang site lets me. :) –  dirtside May 13 '11 at 0:06
    
Is xauth or xhost needed here too? –  Mikel May 13 '11 at 0:44
    
@Mikel I'm not sure how security works when a different user is running X; I think it's fine. I've only ever used xhost for allowing remote connections, but he's SSHing to the machine directly –  Michael Mrozek May 13 '11 at 1:02
    
It's fine if you can log in on the same account she is logged in. Otherwise you'll have to deal with X access control. –  user7440 May 13 '11 at 5:28

As Michael Mrozek illustrates, you can run X applications that display on your wife's desktop. All you need to do is set the DISPLAY environment variable to the right value (almost always :0)… and get yourself authorized.

This solution requires that you have permission to read you wife's files. Access to the X server requires an authentication “cookie”, which is a password that's randomly generated when X starts and stored in a file. The file is often ~/.Xauthority; if it's not, it must be indicated in the XAUTHORITY environment variable. Under Ubuntu with the default setup (using Gdm), your wife's session cookie is not in ~wife/.Xauthority but in a file with an automatically generated name; see ssh DISPLAY variable. See also As root can I launch a graphical program on another users desktop?, Linux: wmctrl cannot open display when session initiated via ssh+screen.

If your wife has a text terminal open, you can use write as suggested by user7440 to write some text in her terminal. That requires that the terminal accepts such notifications; you can turn this on and off with mesg y or mesg n, and I don't know what the default state is on modern terminal emulators.

A more sophisticated mechanism that write is talk. The talk protocol is the ancestor of chat programs; you can talk with anyone on a machine that's running a talk server and whose UDP port 517 or 518 (there are two protocol variants) isn't filtered. So install talkd Install talkd, a client such as ytalk Install ytalk, and ytalk wife. There's also an X client, xtalk Install xtalk. As far as I know, talk has simply fallen off the radar (everybody who cares uses one of the modern chat procotols), and there's no system component that would generate a KDE notification of a talk request.

While you say you can't run any IM client… would a command-line IM client running on your home machine accessed through SSH be ok? There are such, for example weechat Install weechat. You'd still be depending on the some server to connect you with your wife, but it would only be accessed from your home machine, not from your phone.

share|improve this answer
    
finch is the command line version of pidgin. –  ultrasawblade May 13 '11 at 15:21

I'm not 100% sure setting DISPLAY=:0.0 is going to work. I think you need a way to get authorized to connect to the X server on your wife's PC. The tools to do that are xhost and xauth, but they seem to require you already have access to the X server, so presumably only your wife could run them. (Chicken and egg problem.)

Failing that, you might be able to start a second X server, e.g. using X :1, or maybe chvt can help.

For example, something like

# X :1
# export DISPLAY=:1.0
# xmessage 'hello'

seems to work on my system if I run it as root.

X :1 was started on vt7 on my system, so you could also run

# chvt 7

to be sure that that X display is the one currently visible.

share|improve this answer

If she has a terminal window open (use 'who' to find out) you can write to that terminal using 'write'. This will not work with the main terminal as KDE hides it, but any terminal window should work (if it's on the current desktop, not minimized, she's looking at it ...).

share|improve this answer

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.