ubuntu

Ubuntu Minimal远程访问

小樊
32
2025-03-08 11:34:54
栏目: 智能运维
Ubuntu服务器限时活动,0元免费领! 查看>>

要在Ubuntu Minimal系统上实现远程访问,您可以使用以下方法之一:

使用 X11VNC

  1. 安装必要的软件包
sudo apt update
sudo apt install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal lightdm x11vnc
  1. 设置 VNC 连接密码
x11vnc -storepasswd

密码将保存在 ~/.vnc/passwd 文件中。

  1. 创建并启动 VNC 服务

创建一个 x11vnc.service 文件并将其放置在 /lib/systemd/system/ 目录下:

touch ~/x11vnc.service
sudo bash -c 'cat <<EOF > ~/x11vnc.service
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -display :0 -auth /home/your_username/.Xauthority -forever -loop -noxdamage -repeat -rfbauth /home/your_username/.vnc/passwd -rfbport 5900 -shared

[Install]
WantedBy=multi-user.target
EOF'
sudo mv ~/x11vnc.service /lib/systemd/system/
sudo systemctl enable x11vnc.service
sudo systemctl start x11vnc.service

请将 your_username 替换为您的用户名。

  1. 检查 VNC 服务是否在 5900 端口侦听
journalctl -ef -u x11vnc.service | grep 5900
  1. 使用 VNC Viewer 连接

在 VNC Viewer 中输入您的 Ubuntu 机器的 IP 地址,然后输入在步骤 3 中设置的密码。

使用 XRDP

  1. 安装 XRDP
sudo apt update
sudo apt install xrdp
  1. 启动 XRDP 服务并设置为开机自启
sudo systemctl enable xrdp
sudo systemctl start xrdp
  1. 修改 root 密码(如果需要)
sudo passwd root
  1. 从 Windows 远程桌面连接

在 Windows 的远程桌面客户端中输入您的 Ubuntu 机器的 IP 地址,然后输入用户名和密码进行连接。

以上就是在 Ubuntu Minimal 系统上实现远程访问的两种方法。您可以根据自己的需求选择合适的方法。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

相关推荐:Ubuntu Minimal如何远程访问

0
看了该问题的人还看了