linux 远程桌面

安装并启动 xrdp

sudo apt install xrdp
sudo systemctl status xrdp
sudo systemctl enable xrdp

此时 xrdp 监听 0.0.0.0:3389,修改 port 监听本机IP,通过 SSH 隧道连接

$ sudo netstat -plnt | grep rdp
tcp6       0      0 ::1:3350                :::*                    LISTEN      537864/xrdp-sesman  
tcp6       0      0 :::3389                 :::*                    LISTEN      537880/xrdp  

$ sudo vi /etc/xrdp/xrdp.ini

port=tcp://.:3389

$ sudo systemctl restart xrdp
$ netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:3389          0.0.0.0:*               LISTEN      572828/xrdp           

linux 本地桌面

安装RDP客户端 remmina

sudo apt install remmina

创建安全 SSH 隧道

ssh user@xx.xx.xx.xx -L 3399:127.0.0.1:3389

使用 remmina 通过 localhost:3399 连接

参考

https://linuxways.net/centos/how-to-setup-xrdp-to-securely-connect-remote-linux-servers/