• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1069
  • Last Modified:

how to use X from remote

how to use X from remote ?  I just want to know the command to use the remote linux machine .

when I type xhost from ssh it gives  "unable to open the display"
0
sundeepgopal
Asked:
sundeepgopal
3 Solutions
 
DonConsolioCommented:
definitions:

Server: device providing display, keyboard and mouse "services"
Client: computer running the software and using the server ti display data and accept user input

The client "finds" it's server by consulting the "$DISPLAY" environment variable.
(or the -display argument to some programs)
-----------------------------
$ DISPLAY=10.0.0.100
$ export DISPLAY
$ xterm &
$ xterm -display myserver2:0.0 &
-----------------------------
on client: starts a xterm session on X-server 10.0.0.100 and a xterm session on the first display on myserver2
(you may use "DISPLAY=hostname:displaynumber.screennumber" where any server may have 1/more displays with 1/more screens)

The server "allows" clients to connect via config files and/or the "xhost" command
-----------------------------
$ xhost +10.0.0.101
$ xhost myclient1
-----------------------------
on server: authorizes clients 10.0.0.101 and myclient1 to connect (display data and accept user input)
("xhost +" allows ANY client)
0
 
DonConsolioCommented:
Wikipedia (http://en.wikipedia.org/wiki/X11) provides a short introduction to X11
0
 
Gabriel OrozcoSolution ArchitectCommented:
in order to use ssh to forward X traffic, you must edit your /etc/sshd_config file to allow that traffic.

here is a howto:
http://www.xs4all.nl/~zweije/xauth.html

this ons is better:
http://www.vanemery.com/Linux/XoverSSH/X-over-SSH2.html
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
sundeepgopalAuthor Commented:
hey DonConsolio,
Could you please tell me what is 10.0.0.100 ??
where to use the following commands?/
----------------------------
$ DISPLAY=10.0.0.100
$ export DISPLAY
$ xterm &
$ xterm -display myserver2:0.0 &
-----------------------------
where to use this
----------------------------
$ xhost +10.0.0.101
$ xhost myclient1
-----------------------------  
I'm confused and have no idea about it ,please tell me in detail
thanks
0
 
cjl7Commented:
Hi,

You don't need to export the display if you are using ssh...

ssh -Y <client>

of if that isn't working

ssh -X <client>

Then all you X stuff should work... (try issuing xterm on the connected target)

This does require you to have an X compatible desktop that you are running from. If you are running from Windows you need to get a X-server...

//jonas
0
 
Gabriel OrozcoSolution ArchitectCommented:
even if you use ssh -X, if the ssh daemon on the remote computer does not have been edited to forward X, it will not work.

just edit it, uncomment the line, issue a service sshd restart, (you will be disconnected) and then try again using ssh -X <client>

for windows I use Xming (the best opensource X I have seen for windows):
http://freedesktop.org/wiki/Xming
If you are in windows: in xming start the xsession binary. then use PuTTY with X forwarding enabled, and then start whatever you want. an xterm can show you.
0
 
DonConsolioCommented:
> how to use X from remote ?  I just want to know the command to use the remote linux machine .

> when I type xhost from ssh it gives  "unable to open the display"

"from remote" is not exactly a technical description of your problem :-)

are you looking for a way to tunnel a X session through ssh  or are
you trying to start a remote x program ?

in general you have to:
1) find out the names or IP addresses of "client" and "server" (see above)
2) on client:
- set $DISPLAY variable to server - client needs to know where to send output
(if you don't know how to set a variable just ask)
- then start your program
3) on server:
- allow client to connect - usually using the "xhost +name_of_client" command


sample session:
server name: asterix
client name: obelix

-------------------------------------------------------------------------------
don@asterix > echo $DISPLAY  ### show server name
asterix:0.0
don@asterix > xhost +obelix $DISPLAY  ### allow obelix to connect
obelix being added to access control list
don@asterix > ping -c 5 obelix   ### verify network connection
PING obelix (10.0.0.1) 56(84) bytes of data.
64 bytes from obelix (10.0.0.1): icmp_seq=1 ttl=64 time=0.151 ms
64 bytes from obelix (10.0.0.1): icmp_seq=2 ttl=64 time=0.149 ms
64 bytes from obelix (10.0.0.1): icmp_seq=3 ttl=64 time=0.181 ms
64 bytes from obelix (10.0.0.1): icmp_seq=4 ttl=64 time=0.179 ms
64 bytes from obelix (10.0.0.1): icmp_seq=5 ttl=64 time=0.180 ms

--- spice.int.ops.co.at ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4002ms
rtt min/avg/max/mdev = 0.149/0.168/0.181/0.014 ms
don@asterix > ssh -l don obelix ### log on to client
Password:
don@obelix > DISPLAY=asterix:0.0
don@obelix > export DISPLAY
don@obelix > xterm # start my program

-------------------------------------------------------------------------------
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now