Integrating TigerVNC with xrdp on Ubuntu for Remote Desktop Access
TigerVNC and xrdp are often used together to enable remote desktop access to Ubuntu systems. TigerVNC serves as the VNC server, handling graphical display and input, while xrdp acts as an RDP (Remote Desktop Protocol) gateway, allowing Windows and other RDP clients to connect to the Ubuntu desktop. Below is a step-by-step guide to configuring them for seamless integration.
1. Install Required Packages
First, install TigerVNC Server and xrdp on your Ubuntu system. Open a terminal and run:
sudo apt update
sudo apt install tigervnc-standalone-server tigervnc-common xrdp -y
This installs TigerVNC (for VNC functionality) and xrdp (for RDP compatibility).
2. Configure TigerVNC for Desktop Environment
TigerVNC requires a startup script (~/.vnc/xstartup) to launch the desktop environment. Without proper configuration, remote connections may fail or display a blank screen.
- Create/Edit the xstartup File:
Run the following command to open the file in a text editor:nano ~/.vnc/xstartup - Add Desktop Environment Launch Commands:
For GNOME (Ubuntu’s default desktop), add these lines:For XFCE (a lightweight alternative), use:#!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS export XKL_XMODMAP_DISABLE=1 xrdb $HOME/.Xresources gnome-session &#!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS startxfce4 & - Make the Script Executable:
Save the file and run:This ensures the script runs when TigerVNC starts.chmod +x ~/.vnc/xstartup
3. Configure xrdp to Use TigerVNC
xrdp needs to know which VNC server to use for remote sessions. By default, xrdp uses its own session manager, but we’ll point it to TigerVNC.
- Edit the xrdp Start Script:
Open the xrdp startup file:sudo nano /etc/xrdp/startwm.sh - Modify the End of the File:
Comment out any existingexeclines (e.g.,exec /etc/X11/xinit/xinitrc) and add:This tells xrdp to start TigerVNC (listening on displayunset DBUS_SESSION_BUS_ADDRESS unset XDG_RUNTIME_DIR /usr/bin/vncserver :1:1, which corresponds to port5901) when a user connects.
4. Set a VNC Password
TigerVNC requires a password for remote access. Run:
vncpasswd
Enter and confirm a password (note: this is separate from your Ubuntu login password). The password must be between 6–8 characters long.
5. Configure Firewall for Remote Access
If you’re using UFW (Ubuntu’s default firewall), allow traffic on the RDP port (3389) and TigerVNC ports (5901+). Run:
sudo ufw allow 3389/tcp # RDP port for xrdp
sudo ufw allow 5901/tcp # TigerVNC port (display :1)
sudo ufw enable # Enable firewall if not already active
6. Restart Services for Changes to Take Effect
Restart both xrdp and TigerVNC to apply configurations:
sudo systemctl restart xrdp
vncserver -kill :1 # Stop any running TigerVNC instances
vncserver :1 # Restart TigerVNC
7. Connect to Ubuntu via RDP
On a Windows machine, open the Remote Desktop Connection client (built into Windows). Enter the Ubuntu system’s IP address (e.g., 192.168.1.100) and click Connect. When prompted, enter your Ubuntu username and the VNC password you set earlier. You should now see the Ubuntu desktop.
Troubleshooting Common Issues
- Black Screen After Connection:
Ensure the~/.vnc/xstartupfile is executable and contains the correct desktop launch commands. Restart xrdp and TigerVNC after making changes. - xrdp Fails to Start:
Check the xrdp logs (/var/log/xrdp.logand/var/log/xrdp-sesman.log) for errors. Common fixes include ensuringxrdpandtigervnc-standalone-serverare installed and thestartwm.shscript is correctly configured. - Firewall Blocking Connections:
Verify that UFW allows ports 3389 (RDP) and 5901 (TigerVNC). Usesudo ufw statusto check rules.
By following these steps, you can integrate TigerVNC with xrdp on Ubuntu to enable secure, cross-platform remote desktop access. This setup leverages TigerVNC’s performance and xrdp’s compatibility with RDP clients, providing a flexible solution for remote administration or user access.
以上就是关于“ubuntu tigervnc与xrdp如何配合”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm