Kali的qemu2磁盘文件导入PVE并开启RDP远程的记录

Kali系统下载

下载Kali虚拟机镜像:https://cdimage.kali.org/kali-weekly/kali-linux-2025-W30-qemu-amd64.7z

PVE配置

创建一台无硬盘无CD的虚拟机备用,CPU和内存按需分配,例如2C2G,然后虚拟机无需开机。

image

解压kali***.7z后得到qemu2磁盘文件并上传到PVE系统,例如在PVE服务器的/var/lib/vz/images/下创建个103文件夹(为方便区分,编号可以依据虚拟机的ID来)。

使用qm命令将磁盘镜像导入到之前创的虚拟机(我的虚拟机ID是103):

root@pve:/var/lib/vz/images/103# qm importdisk 103 kali-linux-2025-W30-qemu-amd64.qcow2 local-lvm --format qcow2
importing disk 'kali-linux-2025-W30-qemu-amd64.qcow2' to VM 103 ...
format 'qcow2' is not supported by the target storage - using 'raw' instead
  Rounding up size to full physical extent 80.09 GiB
  WARNING: You have not turned on protection against thin pools running out of space.
  WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
  Logical volume "vm-103-disk-0" created.
  WARNING: Sum of all thin volume sizes (<218.20 GiB) exceeds the size of thin pool pve/data and the amount of free space in volume group (16.00 GiB).
transferred 0.0 B of 80.1 GiB (0.00%)
transferred 820.2 MiB of 80.1 GiB (1.00%)
transferred 1.6 GiB of 80.1 GiB (2.01%)
****
transferred 80.1 GiB of 80.1 GiB (100.00%)
transferred 80.1 GiB of 80.1 GiB (100.00%)
unused0: successfully imported disk 'local-lvm:vm-103-disk-0'

然后到PVE界面可以看到一个未使用的磁盘「vm-103-disk-0」:

image

选中该磁盘双击进行编辑添加:

image

然后在选项里,拖动调整启动引导顺序,勾选新导入到磁盘:

image

然后去控制台开机即可:

image

Kali的RDP远程配置

使用默认的账号密码 kali kali登录系统后,切换到root用户,安装xrdp和xface4:

apt install xrdp xface4

参考 周文钦 的分享,修改配置文件 /etc/xrdp/startwm.sh ,在“test -x *** ”之前增加如下内容:

unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
. $HOME/.profile

image

然后重启xrdp并设置开机自启:

systemctl restart xrdp
systemctl enable xrdp

至此,即可使用RDP远程此linux,账号密码使用默认的 kali kali

image
image

若连不上,需检查防火墙。

posted @ 2025-07-22 16:24  Ojox  阅读(85)  评论(0)    收藏  举报