?
Solved

remotely controlling the screen from gdm under linux

Posted on 2006-04-10
12
Medium Priority
?
252 Views
Last Modified: 2010-04-22
I have a remote box.
The only way I know of to get it to display is to sit in front of it, log in.
Then I type

xhost myhostid

to allow myself to display to it.
Then I remote ssh to it, set display:

export DISPLAY=:0.0

and run my graphical code.

I would prefer to log into the box (as root if necessary) and force the machine to recognize me as the one logged into the console. What do I do to make this happen?
When I log into the box from the console, even if I am remote, it doesn't recognize my authority, because the direction is reverse -- my login has been granted permission to display on my remote screen, not on the box I'm on.
0
Comment
Question by:dbkruger
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 17

Expert Comment

by:Dushan De Silva
ID: 16419954
You can try with VNC server.
type on command line "vncserver"
If it not installed, you can install it from installation CD and can configure. If need more details don't hesitate to ask from me.

BR Dushan
0
 
LVL 11

Author Comment

by:dbkruger
ID: 16420453
You misunderstood me, and have the wrong direction.
I am sitting at computer A.
I remote login to computer B.

by default, my ssh already automatically can display a window from a job running on B to A.
But I want to run on B, and display on its screen, which is asleep.
I have already asked and found out how to wake up a monitor under X, and that works.

My question is, how do I simulate logging into remote machine B from the console, so that I have the right to display to its screen?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16424581
> .. and force the machine to recognize me as the one logged into the console.
only if there is a VNC running or with a hardware switch (KVM)
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 11

Author Comment

by:dbkruger
ID: 16426876
I frankly don't believe this is not possible with stock X11, and by definition it cannot be impossible with a little programming, which is why I posted to this area.
Look, if I wrote a script that did an init 3, did my own startx, then I would be in control and could presumably pass my .Xauthority to whom I like. But clearly gdm does something like that, and so I can't believe it's not doable, it's just that I don't know how to do it.

I still don't see what vncserver has to do with it, as I don't want to display remotely at all. I want a program running on B to display on B, I just want to log in remotely to start that process. Suppose I did start vncserver running on the machine. So what? How is an X application on that machine going to draw to itself?

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16427958
> I just want to log in remotely to start that process.
log in and start xterm (or whatever application you want) with display to your local machine
0
 
LVL 11

Author Comment

by:dbkruger
ID: 16433291
ahoffman, I'm not sure if you mean the following, but it does not work.

I am on machine A.
In another room, far away, is a machine B.
I want to run a program on machine B and display the results on the screen in that room to whoever is there. I do not want to run on A and display to B, or run on B and display to A. The only thing I want distributed is the ability to reach out, run something on the remote box that shows up on its screen.

Example:
ssh B
export DISPLAY=:0.0
xterm&

The xterm fails, because I have no right to write to B's screen, even though I am the only one logged in. This is true even if I'm root.
B is running gdm.
If I log into the console, then even though the same user is remotely logged in and logged in at the console, the remote user is stlil not able to write. I need either an xauthority or xhost permission.

xhost B

works, but that requires me to keep machine B logged in at all times with permission to receive drawing from itself.


I could take the machine to runlevel 3:

init 3
startx
and then I would have the right, but I was looking for a more elegant way, perhaps I can set up some xauthority so that when no one is logged in, I can draw on the screen?

Is there some .Xauthority file that exists when no one is logged in?
If not, can one be configured?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16433739
> .. run something on the remote box that shows up on its screen.

prompt on B% nohup xterm -display IP-or-FQDN-of-B:0 &

> The xterm fails, because I have no right to write to B's screen,
X for root is disabled in most modern distributions, unfortunatelly there're different corresponding config file where to find it, best you check in /etc/; some files are login.defs default/login sysconf/login etc.
0
 
LVL 35

Assisted Solution

by:Duncan Roe
Duncan Roe earned 2000 total points
ID: 16451177
How did X get started on B? What is the X authentication in use? Assuming it's Xauth, you have to know where the authority file is. This is easy if you boot the system to a non-X level, login in to a console and type startx to get X started: in that case the .Xauthority will be in your home directory. You can telnet in as that same user, set your DISPLAY to :0.0, and you'll be in business.
If logging in via xdm it's a little more complex IIRC. .Xauthority is *not* in your home directory - rather its location is given by the environment variable XAUTHORITY. You should be able to see this from an xterm when at the console: try typing "env|grep AUTH".
This $XAUTHORITY location is what you need to know when telnetting in. I haven't used xdm for a while so can't remember - if $XAUTHORITY is some kind of dynamic-looking filename then you'll need to record it somewhere for the benefit of remotes - maybe something in your .bashrc like:
  env|grep XAUTHORITY >/dev/null && env|grep XAUTHORITY >/tmp/my_auth
That way the file gets written by bash shells that have the variable and left alone by those that haven't. Now your remote login can use the contents of that file to set up its own .XAUTHORITY
0
 
LVL 35

Accepted Solution

by:
Duncan Roe earned 2000 total points
ID: 16451186
Oops - I mean set up its own XAUTHORITY environment var. Of course if the filename looks like it's constant then just set XAUTHORITY to that
0
 
LVL 35

Expert Comment

by:Duncan Roe
ID: 16451198
Oh you're using gdm - should be much the same as xdm as far as authentication goes. You might get lucky with "locate Xauthority"
0
 
LVL 11

Author Comment

by:dbkruger
ID: 16462688
thanks!

our cluster is down for the holidays, due to (as usual) our air conditioning, but as soon as they fix it, and I can fire up the machines again, I'll check. This sounds like a winner.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question