Win7下使用Putty和VNC远程控制 Linux Host

上一篇 / 下一篇  2011-09-20 15:35:11


        前提条件是LinuxWindows均已配置好,互相能够ping通,这时候可以使用putty这个软件登录到Linux Host上。Putty是个绿色的软件,很好用,使用起来也非常简单。

<!--[if !supportLists]-->1.   <!--[endif]-->http://tartarus.org/~simon/putty-snapshots/x86/putty.exe 下载putty.exe

<!--[if !supportLists]-->2.   <!--[endif]-->点击运行putty.exe,进入PuTTY Configuration及界面

只要在Host Name栏填入HostIP,选择端口号22Connection typeSSH

下图是putty的登陆页面截图:


然后点击open即可连接到Linux Host的登陆界面。输入用户名和密码进入Linux的文本模式。

下图是登陆后文本模式的Linux

 

<!--[if !supportLists]-->3.   <!--[endif]-->VNC Server端的配置

要使用远程控制出现图形界面,可以使用VNC。要使用VNC首先要在Linux Host上安装VNC Server。我用的Linux系统是已安装VNC Server的,所以这里就不描述VNC Server的安装了。(有些Linux系统是自带VNC,而且默认安装了VNC的)

<!--[if !supportLists]-->1)   <!--[endif]-->启动VNC Server:打开终端执行:vncserver(在当前用户主目录下生成.vnc文件夹)

    

如图所示,已启动VNC Server,并分配了一个编号4

<!--[if !supportLists]-->2)   <!--[endif]-->默认情况下,VNC Viewer只能看到VNC Server的命令行,要想看到linux的图形界面,需要对文件/root/.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 &
gnome-session & 

 

 配置完之后,需要重新启动VNC Server

 # vncserver –kill :编号杀掉VNC Server

# vncserver启动VNC Server

<!--[if !supportLists]-->4.   <!--[endif]-->Win7下需要一个客户端VNC Viewer

http://www.realvnc.com/cgi-bin/download.cgi下载VNC Viewer

运行下载的exe文件

VNC Server项输入:IP:编号(这里应该输入:192.168.16.33:4

点击connect后,需要输入密码(密码可利用vncpasswd来设置)

登陆后界面为:

<!--[if !supportLists]-->5. 1.   VNC Server高级设置

<!--[if !supportLists]-->1)<!--[endif]-->设置vncserver启动脚本(/etc/init.d/vncserver)实现系统自启动时启动vncserver

#/etc/rc.d/rc.local文件中加入下面行

/etc/init.d/vncserver start

#也可以用chkconfig命令实现系统自启动时启动vncserver
[root@CPAYNET005 ~]# chkconfig --level 2345 vncserver on

<!--[if !supportLists]-->2)<!--[endif]-->编辑/etc/sysconfig/vncservers

VNCSERVERS="1:root"

VNCSERVERARGS[1]="-geometry 1024x768" 

ARGS中修改"1024x768"来适应自己的X桌面实际参数配置。可以在这里添加任何其他VNC服务器参数配置。在VNCSERVERS中修改root为你希望运行VNC桌面的用户。VNCSERVERS中的1表示VNC以桌面1运行,如果希望添加其他的桌面,可以修改配置如下:

       VNCSERVERS="1:user1 2:user2 3:user3"

3)设置vnc server的访问密码

使用vncpasswd命令

4)在RedHat系统上,使用以下命令启动VNC

/etc/init.d/vncserver start

5)查看VNC Server启动情况

 [root@CPAYNET005 ~]# netstat -tulnp

 

备注:

使用putty可以直接进入Linux的命令行模式,可以在命令行的模式下启动VNC Server,并对VNC Server进行配置,配置完成后可直接使用VNC Viewer进入远程界面。

VNCvncserver的端口是5900+N,给浏览器的端口号是5800+NN是设置的display号,所以要想控制linux服务器,必须打开防火墙响应的端口,否则会报connection error

使用putty时,需要在服务端启动SSH服务。

  

<!--[if !supportLists]-->


TAG: Linux 远程控制 PuTTY Putty VNC vnc

 

评分:0

我来说两句

Open Toolbar