免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 30542 | 回复: 4
打印 上一主题 下一主题

远程桌面设置part1:VNCserver在Fedora上配置过程(转译) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-07-17 07:33 |只看该作者 |倒序浏览
前前言:这是我计划写(和翻译)的有关linux下远程连接(远程桌面)的详细配置教程的第一部分,内容涉及基本的vncserver安装和防火墙的设置. 如果有反响的话,计划再写: part 2: ssh tunnel 支持下的windows vnc 连接
part 3: xremote (xdmcp) + ssh tunnel + exceed( cygwin) 连接等教程

VNCserver在Fedora上配置过程
前言:一直想写一下vncserver在redhat下详细配置过程,以帮助一些向我有同样需求却有懒得去读man page的朋友,后来在www.fedoranews.org上发现已经有人写了一个教程,并且还不错。干脆翻译算了。大家可以直接去阅原文,我这里只是粗略地解释一下,以方便那些不愿意读字母的朋友.

翻译:yunqing
原作者:Thomas Chung
出处:http://fedoranews.org/tchung/vnc/



声明: 版权属原作者Thomas Chung所有,转载请注明出处.

再说一句废话:强烈推荐这个网站,虽然更新比较慢,对Fedora发行版来说比较对口.

以下正文:

什么是VNC?


VNC是虚拟网络计算Virtual Network Computing的缩写. 他是一个远程控制程序,允许用户在因特网的任何地方使用简单的程序来和一个特定的

计算机(服务器)进行交互. 两个交互的计算机不一定非得是同一类型,所以你可以在家里的运行windows的PC上来察看办公室里运行LINUX的机器

。VNC可以自由获取并且有上百万的人在使用,他们来自工业、学术和个人应用等不同层面.

更多的信息请访问 http://www.realvnc.com/

我的系统中已经有这个软件了吗?

键入下面的命令来检查vnc客户端和服务器是否已经安装在你的系统中:

[tchung@tchung101 tchung]$ rpm -q vnc vnc-server
vnc-4.0-0.beta4.3.2
vnc-server-4.0-0.beta4.3.2
[tchung@tchung101 tchung]$

要把vnc配置成一项系统服务,把你的用户名称加入到下面的配置文件中:

  1. [tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/vncservers

  2. # The VNCSERVERS variable is a list of display:user pairs.
  3. #
  4. # Uncomment the line below to start a VNC server on display :1
  5. # as my 'myusername' (adjust this to your own).  You will also
  6. # need to set a VNC password; run 'man vncpasswd' to see how
  7. # to do that.
  8. #
  9. # DO NOT RUN THIS SERVICE if your local area network is
  10. # untrusted!  For a secure way of using VNC, see
  11. # URL:http://www.uk.research.att.com/vnc/sshvnc.html
  12.                                                                                                    
  13. # VNCSERVERS="1:myusername"
  14. VNCSERVERS="1:tchung"
复制代码

在启动vnc服务之前,让我们用vncpasswd这个命令来创建一个vnc的口令

注意这将同时在你的home目录下,创建一个隐藏的目录.vnc,其中有一个文件passwd保存着你的vnc口令.

  1. [tchung@tchung101 tchung]$ vncpasswd
  2. Password:
  3. Verify:
  4. [tchung@tchung101 tchung]$ ls -d .vnc
  5. .vnc
  6. [tchung@tchung101 tchung]$ ls .vnc
  7. passwd
  8. [tchung@tchung101 tchung]$
复制代码


现在来启动vnc服务.

  1. [tchung@tchung101 tchung]$ sudo /sbin/service vncserver start
  2. Starting VNC server: 1:tchung                              [  OK  ]
  3. [tchung@tchung101 tchung]$
复制代码


察看一下.vnc这个目录的内容,应该类似于下面的东西.

  1. [tchung@tchung101 tchung]$ cd .vnc
  2. [tchung@tchung101 .vnc]$ ls
  3. passwd  tchung101:1.log  tchung101:1.pid  xstartup
  4. [tchung@tchung101 .vnc]$
复制代码


编辑这个名为xstartup的脚本,注意到下面红色的部分的注释
将这两行标记成红色的内容前面的注释符号去掉,否则你将只能得到一个什么都没有的灰屏。#!/bin/sh
                                                                                                   
# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc


                                                                                                   
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

因为我们已经修改了启动脚本,现在来重新启动vncserver.

  1. [tchung@tchung101 tchung]$ sudo /sbin/service vncserver restart
  2. Shutting down VNC server: 1:tchung                         [  OK  ]
  3. Starting VNC server: 1:tchung                              [  OK  ]
  4. [tchung@tchung101 tchung]$
复制代码


那么怎样来连接到vncserver? 照下面使用客户端的vncviewer命令.


[tchung@tchung101 tchung]$ vncviewer localhost:1

输入你的vnc口令,看一下结果

更新:
在使用防火墙的情况下来连接到一个远程系统,需要打开端口5901.
加入以下红色的部分,然后重启iptables服务。

[tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/iptables

# Firewall configuration written by redhat-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0]
:FORWARD ACCEPT [0]
:OUTPUT ACCEPT [0]
:RH-Firewall-1-INPUT - [0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

[tchung@tchung101 tchung]$ sudo /sbin/service iptables restart
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
[tchung@tchung101 tchung]$

Forrest Taylor 提供的TIP

让vncserver接受两个不同的用户:


  
  1. VNCSERVERS="1:tchung 2:thomasc"
复制代码


当然你要为两个用户分别运行vncpasswd来设置口令. 并且在你的防火墙修改中,你应该明白VNC使用端口5901给连接1用,如果象上面一样要支

持两个用户,应同时打开5901和5902.

论坛徽章:
0
2 [报告]
发表于 2004-07-23 10:29 |只看该作者

远程桌面设置part1:VNCserver在Fedora上配置过程(转译)

已经解决了我VNC应用的问题,多谢。
还请继续你的计划,准备拜读!

论坛徽章:
0
3 [报告]
发表于 2004-08-20 12:47 |只看该作者

远程桌面设置part1:VNCserver在Fedora上配置过程(转译)

对于您的翻译计划强烈的支持!
平时经常使用vnc,看了文章对它有了更深的了解,3q.

论坛徽章:
0
4 [报告]
发表于 2006-07-18 01:05 |只看该作者
part 3写了没有啊?在CU没有搜到阿

论坛徽章:
0
5 [报告]
发表于 2006-08-18 16:21 |只看该作者
是阿,还有人等着楼主呢……
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP