WSL2中使用Kali桌面

/ 3评 / 1

WSL2相比WSL在性能上提升了很多,而且有独立的Linux内核,取代VM绰绰有余。有人想在WSL2中安装Linux桌面版本,但Windows目前还不支持,在官方文档中有说明WSL2目前还不支持GUI。

Can I run ALL Linux apps in WSL?

No! WSL is a tool aimed at enabling users who need them to run Bash and core Linux command-line tools on Windows.

WSL does not aim to support GUI desktops or applications (e.g. Gnome, KDE, etc.)

Also, even though you will be able to run many popular server applications (e.g. Redis), we do not recommend WSL for hosting production services – Microsoft offers a variety of solutions for running production Linux workloads in Azure, Hyper-V, and Docker.

https://docs.microsoft.com/en-us/windows/wsl/faq

所以只能通过远程的方式连接WSL2上的系统中,以Kali为例,需要在系统中执行以下几步:

  1. sudo apt update && apt upgrade -y
  2. sudo apt install kali-desktop-xfce -y
  3. sudo apt install xrdp -y
  4. sudo service xrdp start

而后通过Windows本地的RDP连接Kali,或者使用VNC也可以。

xfce桌面环境

更新

Kali推出了Win-Kex功能,可以在WSL2的Kali系统中安装VNC服务,并直接启动桌面,无需再从远程桌面连接。

Win-Kex的功能包括:

在Kali中安装Win-Kex:

sudo apt update && sudo apt install -y kali-win-kex

在Kali中设置VNC服务的密码:

kex

之后可以通过kex --passwd修改该密码。

启动桌面时,使用kex命令,桌面系统的用户权限和kex命令的执行用户相同,默认启动窗口模式:

进入窗口模式后,通过F8显示窗口菜单,来选择退出或全屏模式。

启动Kex时如果遇到以下错误提示:

Please try “kex start” to start the service. If the server fails to start, please try “kex kill” or restart your WSL2 session and try again.

执行vncserver --localhost no启动vnc服务后再执行kex命令。

知识共享许可协议  本作品采用知识共享署名-相同方式共享 4.0 国际许可协议进行许可。
  1. 嘤嘤嘤说道:

    kex的密码老是错误,我试过了我所有的常用密码,但我依旧失败

  2. 嘤嘤嘤说道:

    不行

回复 repoog 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注