首 页资讯中心软件分类
您当前的位置:it66.net 爱特下载站资讯中心网络编程 → 文章内容 退出登录 用户管理
本类热门文章
相关内容
使用ssh来run remote X applications
作者:本站  来源:本站原创  发布时间:2007-9-23 14:17:09

减小字体 增大字体

Run remote X applications over network using ssh Reply with quote
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.

OR you can use ssh -Y user@hostname
[] [返回上一页] [打 印]
相关文章
评论
(评论内容只代表网友观点,与本站立场无关!)

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码

软件发布 - 广告合作 - 下载声明 - 友情连接 - 申请连接 - 网站地图 - 管理登陆