个人工具

UbuntuHelp:VNC

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月24日 (四) 14:27的版本 (新页面: {{From|https://help.ubuntu.com/community/VNC}} {{Languages|UbuntuHelp:VNC}} Virtual Network Computing (VNC) allows a computer to be seen and accessed remotely from other computers, who ...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索


Virtual Network Computing (VNC) allows a computer to be seen and accessed remotely from other computers, who can see the screen and control the system using the keyboard and mouse.

VNC is useful for remote technical support or remote access to personal/work computers.

tip: If you need to access a Mac remotely, read Apple Remote Desktop instead.


Enabling other Computers to Connect to your desktop

To allow other computers to access your desktop sessions, when your logged in, perform the following steps. Note: This is like MS Remote Assistance and only works when your are logged into the computer sharing that instance of your Xserv. See below for creating Xservs on the fly and allowing multiple loggings and XDM/GDM.

using GNOME / Ubuntu

System > Preferences > Remote Desktop

'Check' the first two boxes to activate the service:

Allow other users to view your desktop (view only)

Allow other users to control your desktop (view & control).

Below you can set security. The two options are:

Ask you for confirmation (ie; someone at the machine must click OK to grant remote access. This will be a problem if you plan on accessing your home machine from work or visa versa, as no one may be there to grant you access.)

Require the user to enter this password: This will require a password from anyone trying to remotely connect to your machine. This is ALWAYS a good idea.

using KDE / Kubuntu

System Settings > Sharing > Desktop Sharing > Create & Manage Invitations ...

Choose 'New Personal Invitation...' (you give the invitation by whichever means you prefer (Email, Instant Messaging, Written-Down Note) or 'New Email Invitation...'. The newly created invitation will last a default of 1 hour.

Enabling other computers to Connect to XDM/GDM and start sessions.

Unlike the method listed above you when connecting this way you get a login prompt and begin a new session. This also works when no user is logged in and allows multiple parallel loggings.

Step 1

Append the following line to /etc/services

$> gksudo gedit /etc/services

vnc             5901/tcp                        # VNC with GDM

Step 2

Create the following file /etc/xinetd.d/vnc

$> sudo pico /etc/xinetd.d/vnc

service vnc
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd :1 -query localhost -broadcast -once -fp /usr/share/X11/fonts/misc/ -securitytypes=none -desktop=vnc://MyDesktop/
}
  • Note: In 6.10 the default fount's were not found. The -fp /usr/share/X11/fonts/misc/ line should resolve this error.
  • Note: -desktop=vnc://MyDesktop/ is the title that appears to the user when connecting.
  • Note: -query localhost is optional, it may fix a problem when clients get "connection unexpectedly closed"

Step 3

Enable XDMCP in your login configuration to allow remote logins to GDM (the gnome login screen).

Edit /etc/gdm/gdm.conf

$> sudo pico /etc/gdm.conf

find the section [xdmcp] and set the enable to true:

[xdmcp]
....
Enable=true

uncomment this line:

RemoteGreeter=/usr/lib/gdm/gdmlogin

Step 4

Stop and restart Xinetd

$> sudo /etc/init.d/xinetd restart

Problems

  • If you cant connect check your router/port forwarding, firewall, or try running the following to start a session without Xinetd to verify Xvnc is working.
$>  Xvnc :1 -fp /usr/share/fonts/X11/misc/
  • Make sure you connect to the proper port, in this case vnc://localhost:5901. In some clients this is set by choosing display 1.

Accessing Another Computer Remotely

You can access other computers using VNC by clicking:

Applications > Internet > Terminal Server client.

The menu can be accessed by hitting F8. The menu contains an option for sending CTRL-ALT-DEL.

To login to a remote machine using the terminal:

vncviewer [ip address]

tip: if you are connecting through a router you'll need to forward port 5900 to the machine you need to connect to. (VNC can use other ports as well. If you have multiple machines you would like to connect to you can forward 5900 to the first, 5901 to the second, 5902 to the third, etc.) If you are using a non-standard port (ie; other than 5900) you will need to specify the port in the connection command.

example:

vncviewer [ip address]:[port]