debian

Debian虚拟机如何实现远程连接

小樊
37
2025-09-15 00:06:46
栏目: 云计算

Debian虚拟机可通过以下方式实现远程连接:

  1. SSH远程连接

    • 安装OpenSSH服务器:sudo apt update && sudo apt install openssh-server
    • 启动服务并设置开机自启:sudo systemctl enable ssh && sudo systemctl start ssh
    • 获取IP地址:ip addr show,使用SSH客户端(如PuTTY)连接虚拟机IP和默认端口22。
    • (可选)配置防火墙允许SSH:sudo ufw allow ssh
  2. VNC远程桌面连接

    • 安装VNC服务器(如TightVNC):sudo apt install tightvncserver
    • 启动服务并设置密码:vncserver :1(显示编号:1对应端口5901)。
    • 配置防火墙允许VNC端口(默认5901):sudo ufw allow 5901/tcp
    • 使用VNC客户端(如TightVNC Viewer)连接虚拟机IP+端口(如192.168.x.x:5901)。
  3. RDP远程桌面连接(xrdp)

    • 安装xrdp服务器:sudo apt install xrdp
    • 启动服务并设置开机自启:sudo systemctl enable xrdp && sudo systemctl start xrdp
    • 使用Windows远程桌面连接工具,输入虚拟机IP和用户名密码。

安全建议:定期更新系统、使用强密码、限制防火墙端口访问。

0
看了该问题的人还看了