Prerequisites
Before using VNC Viewer to connect to an Ubuntu machine with TigerVNC, ensure the following setup is complete on the Ubuntu server:
- Install TigerVNC Server: Run
sudo apt update && sudo apt install tigervnc-standalone-server tigervnc-commonin the terminal to install the core components. - Set a VNC Password: Execute
vncpasswdand follow prompts to create a password (max 8 characters). This is required for client authentication. - Configure the Desktop Environment: Edit the
~/.vnc/xstartupfile to define the desktop environment (e.g., GNOME/Xfce). For GNOME, use:Save the file, then run#!/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-sessionchmod +x ~/.vnc/xstartupto make it executable. - Start the VNC Server: Launch a session with
vncserver :1(replace:1with your desired display number). This outputs the port number (e.g.,5901for:1). Stop the server withvncserver -kill :1if you need to modifyxstartup. - 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
- Download and Install VNC Viewer: Visit the official RealVNC or TightVNC website, download the viewer, and follow installation instructions.
- Open VNC Viewer: Launch the application from the Start menu.
- 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:1for:1). Click “Connect”. - Authenticate: Enter the VNC password you set earlier. The remote Ubuntu desktop will appear.
On macOS
- Download and Install VNC Viewer: Go to the RealVNC website, download the macOS version, and drag it to the Applications folder.
- Open VNC Viewer: Launch the app from the Applications folder.
- 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. - Authenticate: Input the VNC password. The remote desktop will load.
On Linux
- Install VNC Viewer: Use your package manager (e.g.,
sudo apt install tigervnc-viewerfor Ubuntu/Debian) to install TigerVNC Viewer. - Open VNC Viewer: Run
vncviewerfrom the terminal. - Enter Connection Details: Type the Ubuntu server’s IP address and display number in the prompt (e.g.,
192.168.1.100:1). - 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:). This routes traffic through SSH, securing the connection.
Troubleshooting Common Issues
- Gray Screen: Ensure your
~/.vnc/xstartupfile 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.
以上就是关于“ubuntu tigervnc如何使用VNC Viewer”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm