Ubuntu SSH远程桌面连接需结合命令行与图形化工具,核心步骤如下:
sudo apt update && sudo apt install openssh-server
sudo systemctl start ssh && sudo systemctl enable ssh # 启动并开机自启
sudo ufw allow ssh # 允许SSH端口(默认22)
ssh username@远程IP
,输入密码即可。sudo apt install tightvncserver
vncserver # 首次运行需设置密码
远程IP:1
(显示编号)和密码。vinagre
或xtightvncviewer
连接。sudo apt install xrdp
sudo ufw allow 3389 # 允许RDP端口
sudo systemctl start xrdp
ssh-copy-id
复制公钥到服务器。/etc/ssh/sshd_config
,将Port 22
改为其他端口并重启SSH。/etc/ssh/sshd_config
中添加AllowUsers username@特定IP
,增强安全性。注意:SSH默认仅支持命令行,图形化工具需额外安装软件,根据需求选择方案即可。
参考来源: