Remote graphical login and x-window

snidx2
snidx2 used Ask the Experts™
on
I am trying to remotly login to another machine graphically or by enabling the remote x-window. I am new to this thing and I would like it if someone could just write a simple step by step to get it running..

I used secure shell to access the machine and I have logged on, so now what? i ran xhost <my ip address> but then i get (failed to initiate "").. so i guess i need to enable the remote system to allow remote graphical login?? help me out here, i need some help..
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Assume
Local machine: 10.10.10.5 (X-client)
Remote machine: 10.10.10.6 (X-Server)

Open X windows on the local machine (startx)
At X console  window of the local machine, type:

xhost (name of machine that contains remote program)  or xhost+ for all the machine
(xhost 10.10.10.6 or xhost +)
Open a telnet session with the remote machine on the local machine.
[root@10.10.10.5]# telnet 10.10.10.6
In your telnet window connected to the remote machine, type:
export DISPLAY=(name of your local machine):0
( export DISPLAY=10.10.10.5:0)
Then Run netcfg to test xwindows functionality from telnet session.
Good Luck.
Since you are running ssh, I presume you want to tunnel X through ssh.
If you start
ssh -X user@remote
from a terminal emulator on the local X server, ssh will take care of the nit-gritty details of setting DISPLAY. And since you will seem to be displaying from the localhost on the local system, you don't need to set any additional xhost entries.
After you have connected, type a plain "xhost<Enter>" and you should get the listing from the local X server. If you have only started the X server and an xterm on the local machine (no window manager), you can run any window manager on the remote system, and it will display on the local server.

There are several alternatives though (with or without ssh tunneling), where the two main alternatives are a) a display manager based approach (XDMCP), or b) a VNC based approach.
The display manager approach would need a local X server on the client and a display manager on the server (xdm, kdm, gdm ...), and would give you a familiar logon screen.
The VNC "method" is interresting, since it provides a virtual X server, that you can view in a vnc client application from any host. Since all VNCs I've seen/used to date has a http server/java client "builtin" you don't even have to install a client, just use a regular java-enabled web browser. It works a bit like PcANYWHERE.

Both might need some changes on the remote "serverside", so to give better advice (if this is the way you want to go), we would need a lot more information on both the "server" and the "client" systems (OS, version/distribution, which display managers are installed, whether vnc is installed etc etc). You can not tell too much, but easily too little:-).

-- Glenn
>  xhost <my ip address>
must be done on the local machine, not the remote one, where the IP is that of the remote one
For testing simply use:
  xhost +
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

No ahoffmann, it needs be run on a machine that can reach the host "named" by the correectly set  DISPLAY variable (as I'm sure you are aware). It's just easier to do it locally on the machine with the X server:-).
The DISPLAY was probably not set at all, and the following "X traffic" might even be blocked in the case above. We know too little about the systems involved ATM to say anything more specific.

-- Glenn
Gns, which version of xhost are you using?
My one needs to run on the host with the X server it manipulates I don't know of other ones), see man xhost:

OPTIONS
  Xhost accepts the following command line options described
  below.  For security, the options that effect access  con­
  trol  may  only  be  run from the "controlling host".  For
  workstations, this is the same machine as the server.  For
  X terminals, it is the login host.


BTW, xhost is one of these x-programs which behave different about the DISPLAY environment variable (and -display option), like xlsfont, xdpyinfo, etc..
But I'm shure you're aware about this, Gns ;-)
Exactly right ahoffmann (ouch, that hurts;).
Listed under BUGS, the -display case is covered (-display would try removing the host "display").
I will apologize, since the testing I was doing was via an ssh tunnel... ("this looks local" thinks xhost), I'm more or less (:-) wrong in this way. Clearly a case of "typing before thinking"... sorry.

Anyway, this xhost stuff is mostly not that relevant to snidx2s problem.

-- Glenn
Gns, I disagree again about the ssh stuff:
  even if xhost is called in a ssh session (with or without -X option, doesn't matter) it contacts the server it finds on `unmae -n` (or alike).
Or dou you mean that you have tunneld X with ssh's -L or -R ?

And I think the xhost is essential for snidx2, 'cause almost all Linux distros have disabled it by default (while most old fashioned UNIXs have enabled it).

snidx2, could you please give us your feedback about xhost
Oh don't mind me, I'm having one of those days when everything I look at just turns to ....
I'll shut up until next week, when my head is more tightly screwed on (instead of screwed;).

-- Glenn

Author

Commented:
well i havent tried any of those things above due to lack of time ;)

im running red hat pro 8.0, if that helps?

i would prefer to do it through ssh, instead of telnet. and why is it using port 0?(10.10.10.5:0)


one more thing, if i already have xwindows running on my machine and on the remote machine, how would i get my machine to go into just console mode so i can get the xconsole?

Author

Commented:
and i have to run gdm(gnome?) or kdm(kde?) on the server? then what?
Gns is in weekend, so I'll try ...

> .. using port 0?(10.10.10.5:0)
:0 ist not the port here, but the display number 0

> .. do it through ssh ..
ok, that's fine.
Just follow Gns' suggestion:
   ssh -X user@remote
this should do the trick. After log in simply check the display setting with:
   echo $DISPLAY
you should get something like
   10.10.10.10:0
(or more likely the default:  10.10.10.10:10)
Then make shure that on your local machine X allows connection from the remote one, check with:
   xhost
or allow it with
   xhost +
or better
   xhost 10.10.10.6
now you can issue any x-program on remote machine, like xterm, which then should display on your screen.
If you get no xterm, and no error message, then your DISPLAY environment variable is most likely wrong (check twice that it is correct).

If something goes wrong, please post complete commands and results here.

Commented:
P.S
The X display is the Xserver and
the application is the Xclient

Author

Commented:
thanks alot, i got it working and everything is fine :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial