zoukankan      html  css  js  c++  java
  • Linux xhost VNC 配置总结

    1. 安装命令

    [root@bonnie]# yum -y install vnc vnc-server

    2. 配置文件说明

    [root@bonnie]# 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

    # <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”

    ———————————————————————————————————————————

    将最后两行配置信息取消注释,添加系统账号

    VNCSERVERS="1:root 2:etl"

    VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp -nohttpd "

    VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -nohttpd "

    VNCSERVERS 是用来设定可以使用VNC的服务器账号,可以设定多个,例如上面root、etl,但是中间要用空格隔开。使用VNCVIEWER登录时,192.168.48.128:1表示是以root账号登录,以此类推。

    关于参数配置说明:

    1:-geometry 表示桌面分辨率,默认为1024x768,所以上面的1024x768也可以不写。

    2:-nohttpd  表示不监听HTTP端口(58xx)。

    3:-nolisten tcp 表示不监听TCP端口(60xx)

    4:-localhost 只运行从本机访问。

    5:AlwaysShared 默认只允许一个VNCVIEWER连接,此参数表示同一个显示端口允许多用户同时登录.

    6:-depth  表示色深,参数有8,16,24,32.

    7: SecurityTypes None 登录不需要密码认证VncAuth默认值,要密码认证。

    3. 设置VNC用户密码

    如果此时不设置VNC用户密码,启动vncserver服务,则会报如下错误:

    [root@bonnie ~]# service vncserver start

    Starting VNC server: 1:root [FAILED]

    [root@bonnie /]# vncpasswd

    Password:

    Verify:

    [root@bonnie /]# su - etl

    [etl@bonnie ~]$ vncpasswd

    Password:

    Verify:

    [etl@bonnie ~]$

    4. 启动vncserver服务

    [root@bonnie ~]# service vncserver start

    Starting VNC server: 1:root

    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

    2:etl

    New 'localhost.localdomain:2 (etl)' desktop is localhost.localdomain:2

    Creating default startup script /home/etl/.vnc/xstartup

    Starting applications specified in /home/etl/.vnc/xstartup

    Log file is /home/etl/.vnc/localhost.localdomain:2.log

    [  OK  ]

    VNC会在用户根目录($HOME)下的”.vnc"文件夹下生成一系列文件。其中passwd为vnc用户密码文件,由vncpasswd生成。其他的都由vnc初次启动时生成,xstartup为VNC客户端连接时启动的脚本

    5. 配置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 &

    切换到etl账号,依法炮制

    [root@bonnie ~]# su - etl

    [etl@bonnie ~]$ vi /home/etl/.vnc/xstartup

    [root@bonnie ~]# service vncserver restart

    Shutting down VNC server: 1:root 2:etl [  OK  ]

    Starting VNC server: 1:root

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

    Starting applications specified in /root/.vnc/xstartup

    Log file is /root/.vnc/localhost.localdomain:1.log

    2:etl

    New 'localhost.localdomain:2 (etl)' desktop is localhost.localdomain:2

    Starting applications specified in /home/etl/.vnc/xstartup

    Log file is /home/etl/.vnc/localhost.localdomain:2.log

    [  OK  ]

    chkconfig vncserver on

  • 相关阅读:
    文档对象模型(DOM)
    Gridview,DataList,Repeater 鼠标经过时行颜色变换
    一组经典测试思想观点
    如何编写测试计划
    测试用例 之我见
    软件测试流程 之我见
    经典博文各系列文章
    JS实现在Repeater控件中创建可隐藏区域
    测试感想
    海量数据处理 算法总结
  • 原文地址:https://www.cnblogs.com/bonnienote/p/6472919.html
Copyright © 2011-2022 走看看