
要在没有连接显示设备的Ubuntu Xfce系统上实现Windows远程桌面访问,可按以下步骤操作:
步骤1:在Ubuntu上创建虚拟显示器
由于无物理显示器,需创建虚拟显示器驱动:
1. 安装虚拟显示驱动:
sudo apt update
sudo apt install -y xserver-xorg-video-dummy
2. 创建配置文件 `/etc/X11/xorg.conf.d/10-dummy.conf`:
sudo nano /etc/X11/xorg.conf.d/10-dummy.conf
添加以下内容(分辨率可自定义):
Section “Device”
Identifier “DummyDevice”
Driver “dummy”
Option “ConstantDPI” “true”
Option “IgnoreEDID” “true”
Option “NoDDC” “true”
EndSection
Section “Monitor”
Identifier “DummyMonitor”
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
Modeline “1920×1080” 148.50 1920 2008 2052 2200 1080 1084 1089 1125 +HSync +VSync
EndSection
Section “Screen”
Identifier “DummyScreen”
Monitor “DummyMonitor”
Device “DummyDevice”
DefaultDepth 24
SubSection “Display”
Depth 24
Modes “1920×1080”
EndSubSection
EndSection
3. 重启系统或Xfce服务:
sudo systemctl restart lightdm # 或 gdm3/sddm
步骤2:安装并配置VNC服务器
推荐使用 `x11vnc`:
1. 安装x11vnc:
sudo apt install -y x11vnc
2. 设置VNC访问密码:
x11vnc -storepasswd
按提示输入密码,生成文件 `~/.vnc/passwd`。
3. 创建Systemd服务(开机自启):
sudo nano /etc/systemd/system/x11vnc.service
添加以下内容:
[Unit]
Description=Start x11vnc at startup
After=display-manager.service
[Service]
Type=simple
User=firefly
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/firefly/.vnc/passwd -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
4. 启动服务:
sudo systemctl daemon-reload
sudo systemctl enable x11vnc
sudo systemctl start x11vnc
步骤3:配置防火墙
允许VNC端口(默认5900):
sudo ufw allow 5900
步骤4:从Windows远程连接
1. 下载VNC客户端
– 推荐 [TightVNC](https://www.tightvnc.com/) 或 [RealVNC Viewer](https://www.realvnc.com/en/connect/download/viewer/)
2. 连接Ubuntu
– 打开VNC客户端
– 输入 `Ubuntu设备的IP:5900`(如 `192.168.1.100:5900`)
– 使用步骤2中设置的密码登录
# 手动启动VNC(测试用)
x11vnc -forever -shared -rfbauth ~/.vnc/passwd
No responses yet