ITPub博客

首页 > Linux操作系统 > Linux操作系统 > vncserver创建与客户端连接

vncserver创建与客户端连接

原创 Linux操作系统 作者:atlantisholic 时间:2011-03-21 15:27:38 0 删除 编辑

1. 确认服务器端是否安装了vncserver

Vnc相关依赖包

gtk-vnc-python-0.3.2-3.el5

vnc-server-4.1.2-14.el5

gtk-vnc-0.3.2-3.el5

vnc-4.1.2-14.el5

   [root@localhost: ~]#rpm -q gtk-vnc-python vnc-server gtk-vnc vnc

 

2. 创建VNCSERVER服务:
      [root@localhost /]# vncserver

You will require a password to access your desktops.

Password:     输入vnc 连接密码

Verify:       确认vnc密码

xauth:  creating new authority file /root/.Xauthority

New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1

Creating default startup script. /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log

   查看已经启动的vncserver

      Ps –ef|grep vnc

 

3. 修改配置文件,实现图形化连接

      修改~/.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

         ……….

         ………..

4. 启动对应的VNCSERVER,使用以下命令:

         Vncserver :1  --启动端口号为5901vncserver

         Vncserver :2    --启动端口号为5902vncserver

5. 关闭对应的VNCSERVER,使用以下命令:

  Vncserver –kill :1  --关闭端口号为5901vncserver

  Vncserver –kill :2  --关闭端口号为5902vncserver

6.修改vncserver的密码:

         Vncpasswd

7.  VNCSERVER修改登录用户的信息

        [root@localhost: ~]#vi /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

# .

 

# 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="1:root 2:demo"     此处添加用户

 VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

#vncserver -geometry 800x600      设置vncserver的分辨率
#vncserver -geometry 640x480     
设置vncserver的分辨率

#vncserver -depth 8                  设置vncserver的色深
#vncserver -depth 16               
设置vncserver的色深

8.客户端连接VNC服务器:

a、在linux下,运行vncviewer命令即可,服务器地址的写法形如192.168.3.119:1
b
、在windows下,运行windows版本的vncviewer即可,用法与linux下相近。

c
、用浏览器(平台无关),作为java applet来实现,以形如http://192.168.3.119:5801的方式来启动    vnc 端口从5800 开始依次类推,一般会是58005900

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23071790/viewspace-690068/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-08-30

  • 博文量
    130
  • 访问量
    632406