• VNC Linux 远程桌面控制软件



    简介:

    VNC (Virtual Network Computer)是虚拟网络计算机的缩写。

    VNC 是一款优秀的远程控制工具软件,VNC 是在基于 UNIX 和 Linux 操作系统的免费的开源软件,远程控制能力强大,高效实用,其性能可以和 Windows 和 MAC 中的任何远程控制软件媲美。

    一、检查系统有没有安装 VNC

    shell > rpm -qa | grep -i vnc
    shell >                             ## 空的,NEXT

    二、使用 YUM 安装 VNC

    shell > yum -y install tigervnc tigervnc-server
    shell > rpm -qa | grep -i vnc       ## 安装成功
    tigervnc-1.1.0-8.el6_5.x86_64
    tigervnc-server-1.1.0-8.el6_5.x86_64

    三、配置、启动 VNC

    shell > vim /etc/sysconfig/vncservers
     21  VNCSERVERS="1:root 2:wang"                ## 配置远程桌面登陆的用户名,1/2 为用户序号,用户间要有空格
     22  VNCSERVERARGS[1]="-geometry 1024x768"     ## [1] 为用户序号;指定分辨率为 1024x768
     23  VNCSERVERARGS[2]="-geometry 1024x768"        多用户分别指定
    
    
    shell > vncserver :1                           ## 为序号为 1 的用户启动 VNC
    You will require a password to access your desktops.
    Password:                                      ## 启动必须为该用户设置 VNC 密码(vncpasswd 专门用于设置VNC密码)
    Verify:                                           可惜我使用这个命令却没成功,不知道为什么
    xauth:  creating new authority file /root/.Xauthority
    New 'localhost:1 (root)' desktop is localhost:1
    Creating default startup script /root/.vnc/xstartup
    Starting applications specified in /root/.vnc/xstartup
    Log file is /root/.vnc/localhost:1.log
    shell > netstat -anpt | grep vnc
    tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      1895/Xvnc
    tcp        0      0 0.0.0.0:6001                0.0.0.0:*                   LISTEN      1895/Xvnc
    tcp        0      0 :::6001                     :::*                        LISTEN      1895/Xvnc

    ## 序号为 1 的VNC用户 root 监听的端口为 5901 ,多个用户以依次为 5902 、5903 ……( 规则为 5900+用户序号 )

    shell > su - wang                               ## 必须切过去
    [wang@localhost ~]$ vncserver :2                ## 为序号为 1 的用户启动 VNC、设置密码
    You will require a password to access your desktops.
    Password:
    Verify:
    xauth:  creating new authority file /home/wang/.Xauthority
    New 'localhost:2 (wang)' desktop is localhost:2
    Creating default startup script /home/wang/.vnc/xstartup
    Starting applications specified in /home/wang/.vnc/xstartup
    Log file is /home/wang/.vnc/localhost:2.log
    [wang@localhost ~]$ netstat -anpt | grep vnc
    (Not all processes could be identified, non-owned process info
     will not be shown, you would have to be root to see it all.)
    tcp        0      0 0.0.0.0:5902                0.0.0.0:*                   LISTEN      2304/Xvnc
    tcp        0      0 0.0.0.0:6002                0.0.0.0:*                   LISTEN      2304/Xvnc
    tcp        0      0 :::6002                     :::*                        LISTEN      2304/Xvnc

    ## 序号为 2 的VNC用户 wang 所监听的端口为 5902

    [wang@localhost ~]$ exit
    
    ## vncserver :1 或 :2        启动某个用户的 VNC(如不是当前用户需 su - 到这个用户)
       vncserver -kill :1 或 :2  关闭某个用户的 VNC(如不是当前用户需 su - 到这个用户)
       vncserver -list           查看当前登陆用户有没有开启 VNC (如不是当前用户需 su - 到这个用户)
       service vncserver start|stop|restart  开启、关闭服务(所有用户的 VNC)
    
    shell > chkconfig --add vncserver       ## VNC 加入开机启动
    shell > chkconfig --level 35 vncserver on

    四、防火墙允许 VNC 通过

    shell > vim /etc/sysconfig/iptables
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT

    ## 也可以使用 iptables 命令添加,如果你只开一个 VNC 则只允许 5901 即可

    shell > service iptables restart   ## 重启防火墙使规则生效

    五、Windows 客户端测试

    VNC Viewer for Windows 下载地址 http://www.realvnc.com/download/binary/1613/

    客户端 VNC Server: 处输入 IP:1 、IP:2 如 :192.168.1.80:1 等 然后输入该用户 VNC 密码

  • 相关阅读:
    gitblit安装使用
    谷歌AMP和百度MIP是什么鬼?
    微信小程序开发体验
    设计模式之策略模式
    【前端安全】JavaScript防XSS攻击
    【前端安全】JavaScript防流量劫持
    设计模式之“中间件模式”
    设计模式之Mixin模式
    设计模式之观察者模式
    设计模式之单例模式
  • 原文地址:https://www.cnblogs.com/wangxiaoqiangs/p/5796556.html
Copyright © 2020-2023  润新知