Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐: 强烈推荐:Ylmf OS 3.0 正式版发布附迅雷高 XP系统下硬盘安装Fedora 14图文教程
搜索:
您的位置: Linux安全网 > Linux入门 > » 正文

烂泥:linux学习之VNC远程控制(一)

来源: 未知 分享至:
烂泥:linux学习之VNC远程控制(一)   最近一直在学习linux的有关知识,因为以前我所有的操作及应用全部在windows下进行的,考虑到以后的个人发展及其他的方面需要,从现在开始要慢慢的学习和接触linux系统了。   我现在使用的红帽的企业版RHEL 5,也有一部分是在RHEL 6上进行实验的。   下面我就开始linux的正式学习了,首先是进行关于远程控制的配置。   实验环境: 服务器端:RHEL 5 客户端:windows 远程登录使用软件:TightVnc此次实验不进行HTTP登录   PS:也许你在网上看到很多有关这方面的文章,但是我可以保证他们的都没有这么全面,也没有这么傻瓜式的入门   在配置远程控制之前,肯定要安装好RHEL的安装,所以此实验是在系统安装好之后进行的。   一、 首先使用rpm -qa|grep vnc命令检查VNC服务是否安装 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image002\" border=\"0\" alt=\"clip_image002\" src=\"/uploads/allimg/111107/09234K641-0.jpg\" height=\"443\" ?580? />   现在可以看到,VNC服务已经安装了。   但是VNC服务是否已经启动呢?我们可以通过这个命令查看: Service vncserver status 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image004\" border=\"0\" alt=\"clip_image004\" src=\"/uploads/allimg/111107/09234L930-1.jpg\" height=\"443\" ?580? />   我们现在可以看出,尽管VNC服务已经安装,但是VNC服务是没有启动的。那么我们如何启动该服务呢?   在启动VNC服务之前,我们还有一些工作要做。   第一、要配置VNC,该配置文件名是vncservers,位于“/etc/sysconfig/”下,我们可以同vi来对此文件进行编辑。 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image006\" border=\"0\" alt=\"clip_image006\" src=\"/uploads/allimg/111107/09234I200-2.jpg\" height=\"440\" ?580? /> 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image008\" border=\"0\" alt=\"clip_image008\" src=\"/uploads/allimg/111107/09234K2I-3.jpg\" height=\"331\" ?580? /> [root@localhost ~]# cat /etc/sysconfig/vncservers # The VNCSERVERS variable is a list of display:user pairs. # # Uncomment the lines below to start a VNC server on display :2 # as my \'myusername\' (adjust this to your own). You will also # need to set a VNC password; run \'man vncpasswd\' to see how # to do that. # # DO NOT RUN THIS SERVICE if your local area network is # untrusted! For a secure way of using VNC, see # <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>. # Use \"-nolisten tcp\" to prevent X connections to your VNC server via TCP. # Use \"-nohttpd\" to prevent web-based VNC clients connecting. # Use \"-localhost\" to prevent remote VNC clients connecting except when # doing so through a secure tunnel. See the \"-via\" option in the # `man vncviewer\' manual page. #VNCSERVERS=\"2: myusername\" #VNCSERVERARGS[2]=\"-geometry 800x600 -nolisten tcp -nohttpd -localhost\"   以上是vcnservers文件的内容,请注意我标注出来的两行。我们的配置主要是针对这两行进行的。而修改此配置文件的目的:   一、确定能进行远程登录的用户,及第一次远程登录系统的显示桌面号   二、确定用户远程登录成功后,配置用户登录后的桌面及其他相关项(这个我会下一篇做详细的介绍   我们现在要做的就是要把这两行的注释去掉,同时还要增加相应的项,修改后的结果如下: VNCSERVERS=\"1: root 2:lanni 3:jinyang\" VNCSERVERARGS[2]=\"-geometry 800x600 -nolisten tcp -nohttpd -localhost\"   说明:其中VNCSERVERS=\"1: root 2:lanni 3:jinyang\" 中1:root,表示root用户在第一次远程登录时,使用的桌面号为1,以此类推,用户lanni使用的是2,用户jinyang使用的是3 而VNCSERVERARGS[2]=\"-geometry 800x600 -nolisten tcp -nohttpd -localhost\",是用户登录后对桌面进行配置的相关参数   第二、Vncservers文件配置完成后,下面我们就要进行防火墙的相关设置了。首先我们先看看防火墙是否已经开启。 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image010\" border=\"0\" alt=\"clip_image010\" src=\"/uploads/allimg/111107/09234I100-4.jpg\" height=\"443\" ?580? />   在此我要做一点说明,因为远程控制牵涉到防火墙的问题,所以我在系统安装时就已经把防火墙禁用了。   第三、对远程登录的用户进行VNC密码的设置。我们现已系统管理员root用户为例。   使用vncserver命令,进行密码设置。系统会提示你,要输入两次密码进行确认。 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image012\" border=\"0\" alt=\"clip_image012\" src=\"/uploads/allimg/111107/09234J562-5.jpg\" height=\"440\" ?580? />   现在我们在切换到普通户用,需要使用的命令是:su 用户名 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image014\" border=\"0\" alt=\"clip_image014\" src=\"/uploads/allimg/111107/09234J401-6.jpg\" height=\"440\" ?580? />   设置普通用户的VNC登录密码 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image016\" border=\"0\" alt=\"clip_image016\" src=\"/uploads/allimg/111107/09234LM4-7.jpg\" height=\"440\" ?580? />   以上全部设置正确无误后,我们就可以正常启动VNC服务了。启动该服务需要使用到如下的命令:service vncserver start   为了让vnc开机启动,我们可以使用如下的命令: chkconfig vncserver on 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image018\" border=\"0\" alt=\"clip_image018\" src=\"/uploads/allimg/111107/09234I404-8.jpg\" height=\"421\" ?558? />   执行该命令之后,我们看看vnc是不是真的已经启动了。使用如下命令进行查看:service vncserver status 650) this.width=650;\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"clip_image020\" border=\"0\" alt=\"clip_image020\" src=\"/uploads/allimg/111107/09234M964-9.jpg\" height=\"437\" ?580? />   好了,现在可以看到服务器端的VNC基本上都已经配置好了。那么下面就应该在客户端进行登录了。   在客户端登陆之前还有几点是我们需要注意的,在文章的开头我已经说了,此次实验不进行HTTP登录,所以我们不考虑HTTP的环境。那么在客户端进行登录时,登录的方式是:

Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史