首页主机资讯ubuntu tigervnc如何使用VNC Viewer

ubuntu tigervnc如何使用VNC Viewer

时间2025-10-21 12:22:03发布访客分类主机资讯浏览990
导读:Prerequisites Before using VNC Viewer to connect to an Ubuntu machine with TigerVNC, ensure the following setup is compl...

Prerequisites
Before using VNC Viewer to connect to an Ubuntu machine with TigerVNC, ensure the following setup is complete on the Ubuntu server:

  1. Install TigerVNC Server: Run sudo apt update & & sudo apt install tigervnc-standalone-server tigervnc-common in the terminal to install the core components.
  2. Set a VNC Password: Execute vncpasswd and follow prompts to create a password (max 8 characters). This is required for client authentication.
  3. Configure the Desktop Environment: Edit the ~/.vnc/xstartup file to define the desktop environment (e.g., GNOME/Xfce). For GNOME, use:
    #!/bin/sh
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    export XDG_SESSION_TYPE=x11
    export GNOME_SHELL_SESSION_MODE=ubuntu
    exec dbus-launch --exit-with-session gnome-session
    
    Save the file, then run chmod +x ~/.vnc/xstartup to make it executable.
  4. Start the VNC Server: Launch a session with vncserver :1 (replace :1 with your desired display number). This outputs the port number (e.g., 5901 for :1). Stop the server with vncserver -kill :1 if you need to modify xstartup.
  5. Configure Firewall (if enabled): Allow VNC traffic by running sudo ufw allow 5901/tcp (adjust port if using a different display number).

Using VNC Viewer to Connect
VNC Viewer is available for Windows, macOS, and Linux. Below are steps for common platforms:

On Windows

  1. Download and Install VNC Viewer: Visit the official RealVNC or TightVNC website, download the viewer, and follow installation instructions.
  2. Open VNC Viewer: Launch the application from the Start menu.
  3. Enter Connection Details: In the “New Connection” window, enter the Ubuntu server’s IP address followed by the display number (e.g., 192.168.1.100:1 for :1). Click “Connect”.
  4. Authenticate: Enter the VNC password you set earlier. The remote Ubuntu desktop will appear.

On macOS

  1. Download and Install VNC Viewer: Go to the RealVNC website, download the macOS version, and drag it to the Applications folder.
  2. Open VNC Viewer: Launch the app from the Applications folder.
  3. Enter Connection Details: Type the Ubuntu server’s IP address and display number in the address bar (e.g., 192.168.1.100:1). Press Enter.
  4. Authenticate: Input the VNC password. The remote desktop will load.

On Linux

  1. Install VNC Viewer: Use your package manager (e.g., sudo apt install tigervnc-viewer for Ubuntu/Debian) to install TigerVNC Viewer.
  2. Open VNC Viewer: Run vncviewer from the terminal.
  3. Enter Connection Details: Type the Ubuntu server’s IP address and display number in the prompt (e.g., 192.168.1.100:1).
  4. Authenticate: Enter the VNC password. The remote desktop will display.

Optional: Enhance Security with SSH Tunneling
To encrypt VNC traffic, set up an SSH tunnel between your local machine and the Ubuntu server. On your local machine, run:

ssh -L 5901:localhost:5901 your_username@your_server_ip

Replace your_username and your_server_ip with your actual credentials. Then, connect VNC Viewer to localhost:1 (or localhost:< display_number> ). This routes traffic through SSH, securing the connection.

Troubleshooting Common Issues

  • Gray Screen: Ensure your ~/.vnc/xstartup file is correctly configured (e.g., uses the right desktop environment) and has execute permissions. Restart the VNC server after making changes.
  • Connection Refused: Verify the VNC server is running (vncserver -list), the firewall allows the port, and the IP address is correct.
  • Password Errors: If you forget the VNC password, reset it with vncpasswd. Note that this only changes the VNC password, not your system login password.

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: ubuntu tigervnc如何使用VNC Viewer
本文地址: https://pptw.com/jishu/731031.html
ubuntu上jellyfin如何进行性能监控 Debian域名SSL证书安装

游客 回复需填写必要信息