在Ubuntu虚拟机中进行远程连接,通常有以下几种方法:
sudo apt update
sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
ip addr show
或者在虚拟机管理器(如VMware Workstation、VirtualBox)中查看网络设置。 4. 使用SSH客户端进行远程连接。例如,使用PuTTY:
sudo apt install x11vnc
x11vnc -storepasswd
touch /etc/systemd/system/x11vnc.service
sudo cat <<EOF > /etc/systemd/system/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 /etc/systemd/system/x11vnc.service /lib/systemd/system/
sudo systemctl enable x11vnc.service
sudo systemctl start x11vnc.service
请将your_username
替换为您的用户名。
sudo apt install xrdp
sudo ufw allow 3389
sudo systemctl enable xrdp
sudo systemctl start xrdp
以上步骤可以帮助您成功远程连接到Ubuntu虚拟机。请根据您的具体需求选择合适的连接方式。