ubuntu

Ubuntu VNC如何连接到其他设备

小樊
52
2025-09-29 08:42:15
栏目: 编程语言

Connecting Ubuntu VNC to Other Devices: A Step-by-Step Guide
To connect to another device (e.g., a Windows PC, macOS machine, or another Linux system) using VNC from an Ubuntu system, you’ll need to configure the Ubuntu machine as a VNC client (to initiate the connection) and the target device as a VNC server (to accept the connection). Below is a structured guide covering both scenarios:

1. Prepare the Ubuntu System as a VNC Client

The Ubuntu system will use a VNC client to connect to the remote server. Install a client like Remmina (recommended for its flexibility) or TightVNC Viewer:

sudo apt update
sudo apt install remmina tightvncviewer -y

Remmina is a graphical client with support for multiple protocols (VNC, RDP, SSH), while tightvncviewer is a lightweight command-line tool.

2. Configure the Target Device as a VNC Server

The target device (Windows, macOS, or Linux) must run a VNC server to share its desktop. Below are configurations for common platforms:

A. For Ubuntu/Linux Target Devices

If the target is another Ubuntu system, follow these steps to set up a VNC server:

B. For Windows Target Devices

On a Windows PC, install a VNC server like RealVNC or TightVNC:

C. For macOS Target Devices

macOS has a built-in screen-sharing feature that supports VNC:

3. Connect to the Target Device from Ubuntu

Once the target device is configured as a VNC server, use the Ubuntu client to initiate the connection:

Option 1: Using Remmina (Graphical Client)

  1. Open Remmina from the Ubuntu application menu.
  2. Click the + icon to create a new connection.
  3. In the “Protocol” dropdown, select VNC.
  4. Enter the target device’s details:
    • Server: <target_IP>:<display_number> (e.g., 192.168.1.100:1 for a Windows PC or 10.0.0.5:5901 for an Ubuntu server).
    • Username: Your username on the target device (optional, depends on server configuration).
    • Password: The VNC password you set on the target device.
  5. Click Save and Connect. Enter the password when prompted.

Option 2: Using TightVNC Viewer (Command-Line Tool)

Run the following command in the Ubuntu terminal, replacing <target_IP> and <display_number>:

vncviewer <target_IP>:<display_number>

For example, to connect to a Windows PC at 192.168.1.100 with display :1, use:

vncviewer 192.168.1.100:1

Enter the VNC password when prompted.

4. Security Best Practices

By following these steps, you can securely connect your Ubuntu system to other devices using VNC, enabling remote access to their desktop environments.

0
看了该问题的人还看了