linux远程桌面同步,VNC Server+Vino-Server 实现远程桌面同步

VNC Server + Vino Server实现自动桌面同步共享(可作为远程教学):

以下通过实验实现 RHEL6(Server)自动将桌面共享到RHEL5(Client)上

原理:server端开启vncserver的DISPLAY:4,监听TCP 5904端口;开启vino-server,允许别人查看自己的桌面,监听TCP 5900端口;使用vncserver的DISPLAY:4连接vino-server开启的DISPLAY:0达到同步桌面的效果。

RHEL6 Server端:

1.配置VNC Server

[root@rhel6 ~]# vncserver

New 'rhel6.xfcy.org:1 (root)' desktop is rhel6.xfcy.org:1

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/rhel6.xfcy.org:1.log

[root@rhel6 ~]# vi /etc/sysconfig/vncservers

VNCSERVERS="4:root"

VNCSERVERARGS[4]="-geometry 800x600"

[root@rhel6 ~]# vncpasswd

Password:

Verify:

[root@rhel6 ~]# /etc/init.d/vncserver start

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/rhel6.xfcy.org:4.log

[ OK ]

[root@rhel6 ~]# vi .vnc/xstartup #连接到VNC Server的DISPLAY:4都会读取该文件

#!/bin/sh

sleep 5

vncconfig -display :4.0 -AcceptKeyEvents=0 -AcceptPointerEvents=0 -AlwaysShared

vncviewer -Fullscreen -ViewOnly 127.0.0.1 & #将DISPLAY:4连接到Vino Server可达到同步桌面的效果

2.配置自动共享桌面脚本

[root@rhel6 ~]# vi catchdesktop.sh #创建一个抓桌面的脚本(将拷贝到rhel5中)

#!/bin/sh

X :18 & #为rhel6启动一个DISPLAY:18(可防止rhel6未登录系统)

sleep 5

export DISPLAY=:18.0 #导入DISPLAY到:18(即上面创建的DISPLAY)

vncviewer -FullScreen -Shared -ViewOnly rhel6:4 -passwd /etc/X11/passwd & #通过vncviewer访问rhel5的DISPLAY:3

[root@rhel6 ~]# chmod +x catchdesktop.sh

[root@rhel6 ~]# scp -rp catchdesktop.sh rhel5:/usr/sbin/

catchdesktop.sh 100% 157 0.2KB/s 00:00

[root@rhel6 ~]# scp .vnc/passwd rhel5:/etc/X11/passwd #将vnc的passwd文件拷贝到rhel6中

passwd 100% 8 0.0KB/s 00:000b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值