服务器监听

服务器监听

我试图在我的 Ubuntu 11.04 中创建一个 VNC 服务器,这样即使系统重启,我也可以登录。因此,我尝试了以下操作,但从 vncviewer 无法连接。

服务器监听

  1. 安装

    $ sudo -s
    # apt-get install vnc4server xinetd
    
  2. 安全

    # vncpasswd /root/.vncpasswd
    Password:
    Verify:
    
  3. 即服务

    # vim /etc/xinetd.d/Xvnc
    service Xvnc
    {
        type = UNLISTED
        disable = no
        socket_type = stream
        protocol = tcp
        wait = yes
        user = root
        server = /usr/bin/Xvnc
        server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd
        port = 5901
    }
    
  4. 启动服务

    # service xinetd stop
    # service xinetd start
    

客户尝试

$ vncviewer 192.168.1.125:1

TigerVNC Viewer for X version 1.0.90 - built May 10 2011 10:04:22
Copyright (C) 2002-2005 RealVNC Ltd.
Copyright (C) 2000-2006 TightVNC Group
Copyright (C) 2004-2009 Peter Astrand for Cendio AB
See http://www.tigervnc.org for information on TigerVNC.

Wed Sep  7 10:08:20 2011
 CConn:       connected to host 192.168.1.125 port 5901
 main:        read: Connection reset by peer (104)

答案1

您可能想尝试 x11vnc - 一种非常强大且相对易于使用的解决方案。

参见我之前的回答有关更多信息,请参阅类似主题。该答案还指出了在登录时将 x11vnc 设置为服务的多种不同方法。我已将其用于我自己的个人服务器,并且它完全可靠。

答案2

我希望你已经安装了 vnc-server 和 xinetd,只需要执行以下操作

 iptables –I INPUT -p tcp --dport 5900 -j ACCEPT
 chkconfig vncserver on
 server vncserver restart

如果可以的话,请重新启动然后在其他电脑上尝试。

reboot

如果您想访问外部,请确保您允许来自路由器端口 5900 和 VNC 服务器 IP 地址的流量。

相关内容