nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Run remote X applications over network using ssh

This is a discussion on Run remote X applications over network using ssh within the Getting started tutorials forums, part of the Linux Getting Started category; This small howto guides you to run remote X applications over network using ssh. Introduction The X windows system created ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Linux answers from nixCraft.


Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14-09-2005, 05:36 PM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default Run remote X applications over network using ssh

This small howto guides you to run remote X applications over network using ssh.

Introduction
The X windows system created by X consortium www.X.org
  • * It is client/server architecture.
    * X is OS independent and it is a Protocol
    * X protocol works over TCP/IP

What is X server?
X-server -> Talks with your hardware (VGA card, mouse, monitor etc) => It provides the screen (or display) and manages the resources. For more info on X Window System and X client-server model and network transparency visit http://en.wikipedia.org/wiki/X_server

X-Client -> Uses the display/screen provided by X-Server to display GUI/Application. It does not care how mouse or vga card works.

For example you can run X application from another computer. All you need is to setup correct DISPLAY variable.

Our demo setup with two computers:
debian-server
IP: 192.168.1.1

Suse-Linux (Laptop)
IP: 192.168.1.11

Now you would like to redirect output of laptop to server. Please note that X works on almost all UNIX like operating systems like FreeBSD, HP/UX, Solaris, Linux etc. So the commands remains same for all variant of UNIX OS.

1) Login to Debian Linux server
Code:
xhosts 192.168.1.11
xhost is server access control program for X server. The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server. In our example we are allowing host (192.168.1.11) to access server. All communication done using 6000 port.

2) Login to Suse-Laptop and run program on Debain Linux
Code:
export DISPLAY=192.168.1.1:0
xeyes &
The output of xeyes will be on debian server and not on the Suse. DISPLAY is variable which point out X server IP-address/hostname to redirect output.

Secure login over ssh i.e. forward X over ssh
SSH server has built in support to run X application remotely. Traffic between suse and debian system remains encrypted.

1) Make sure XForwarding option is on
Login to debian server, open /etc/ssh/sshd_config using text editor such as vi/vim:
Code:
vi /etc/ssh/sshd_config
2) Setup X11Forwarding to yes
Code:
X11Forwarding yes
3) Save file and restart ssh server
Code:
/etc/init.d/ssh restart
4) Allow laptop to run programs:
Code:
xhosts 192.168.1.11
5) Login from suse computer and start open office writer:
Code:
export DISPLAY=192.168.1.1:0 
ssh -X user@192.168.1.1 oowriter 
ssh -X user@192.168.1.1 xeyes
Replace user with actual user name.

This is my first small tutorial; please feel to comment back or to add your own stuff to it.
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #2 (permalink)  
Old 15-09-2005, 03:20 PM
Administrator
User
 
Join Date: Jan 1970
Posts: 43
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 10
vivek has disabled reputation
Default

gr8 works
Reply With Quote
  #3 (permalink)  
Old 19-06-2006, 03:40 PM
Member
User
 
Join Date: Jan 2005
Location: Pune, India.
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Ashish Pathak
Send a message via MSN to Ashish Pathak Send a message via Yahoo to Ashish Pathak
Default

Hey Buddy,

You can also try ssh -Y to achive the same!
I normally use -Y with ssh when I need a display.
Reply With Quote
  #4 (permalink)  
Old 19-06-2006, 05:42 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
OS: Debian GNU/Linux
Posts: 506
Thanks: 0
Thanked 8 Times in 6 Posts
Rep Power: 7
monk has a spectacular aura about monk has a spectacular aura about
Default

@Ashish: Good point.

@rockdalinux: remember –Y is more secure (as it enables trusted X11 forwarding) than –X so it is best to use –X option.
Reply With Quote
  #5 (permalink)  
Old 23-06-2006, 08:33 PM
Junior Member
User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
rohan208
Default

I've been looking for this, thanks.

I found adding something like this to ~/.bashrc very useful..

Code:
if [ "$SSH_CLIENT" != "" ]; then
    export DISPLAY=`echo $DISPLAY| cut -d\  -f1| cut -d: \f4`:0
fi

..R
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Network Diagram kasimani Computer Networking and Internet/broadband 4 19-06-2008 06:21 AM
How to use two ISP in same network satishap Getting started tutorials 2 24-03-2008 09:58 PM
network message anharikrishna Networking, Firewalls and Security 1 06-09-2007 03:02 PM
Ubuntu: Issue accessing any System applications hightech Linux software 4 29-01-2007 09:56 AM
Network Monitoring puppen Linux software 2 10-05-2006 11:01 PM


All times are GMT +5.5. The time now is 10:24 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38