本文 首发于 🌱 煎茶, 转载 请注明 来源。
xrdp 的配置让我充满疑惑,今天误打误撞完成了 kali 下的 xrdp 配置,能够顺利远程桌面进入 kali,这里记录一些可能必须的步骤,以备后用。
首先按照 kali 官网给出的 xrdp 配置脚本:
#!/bin/sh echo "[i] Updating and upgrading Kali (this will take a while)" apt-get update apt-get dist-upgrade -y
echo "[i] Installing Xfce4 & xrdp (this will take a while as well)"
apt-get install -y kali-desktop-xfce xorg xrdp
echo "[i] Configuring xrdp to listen to port 3390 (but not starting the service)"
sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
保存后 sudo
执行,自动配置 xrdp。
如果下载慢可以配一下 USTC Kali 软件源。
之后设定默认命令行启动,否则无法加载远程桌面:
# 命令行启动
$ systemctl set-default multi-user.target图形界面启动
systemctl set-default graphical.target</code></pre></div></div><p>之后使能 <code>xrdp</code> 服务:</p><div class="rno-markdown-code"><div class="rno-markdown-code-toolbar"><div class="rno-markdown-code-toolbar-info"><div class="rno-markdown-code-toolbar-item is-type"><span class="is-m-hidden">代码语言:</span>javascript</div></div><div class="rno-markdown-code-toolbar-opt"><div class="rno-markdown-code-toolbar-copy"><i class="icon-copy"></i><span class="is-m-hidden">复制</span></div></div></div><div class="developer-code-block"><pre class="prism-token token line-numbers language-javascript"><code class="language-javascript" style="margin-left:0"> systemctl enable xrdp
systemctl start xrdp</code></pre></div></div><p>避免 <code>ssl</code> 证书无法验证,将 <code>xrdp</code> 用户加入 <code>ssl-cert</code> 用户组:</p><div class="rno-markdown-code"><div class="rno-markdown-code-toolbar"><div class="rno-markdown-code-toolbar-info"><div class="rno-markdown-code-toolbar-item is-type"><span class="is-m-hidden">代码语言:</span>javascript</div></div><div class="rno-markdown-code-toolbar-opt"><div class="rno-markdown-code-toolbar-copy"><i class="icon-copy"></i><span class="is-m-hidden">复制</span></div></div></div><div class="developer-code-block"><pre class="prism-token token line-numbers language-javascript"><code class="language-javascript" style="margin-left:0">sudo adduser xrdp ssl-cert</code></pre></div></div><p>之后可以重启试一下能否成功,记得官方配置端口为 <code>3390</code> 而非 <code>3389</code>:</p><div class="rno-markdown-code"><div class="rno-markdown-code-toolbar"><div class="rno-markdown-code-toolbar-info"><div class="rno-markdown-code-toolbar-item is-type"><span class="is-m-hidden">代码语言:</span>javascript</div></div><div class="rno-markdown-code-toolbar-opt"><div class="rno-markdown-code-toolbar-copy"><i class="icon-copy"></i><span class="is-m-hidden">复制</span></div></div></div><div class="developer-code-block"><pre class="prism-token token line-numbers language-javascript"><code class="language-javascript" style="margin-left:0"> reboot
如果不行配置一下这个再重启尝试:
# To set the system default to xfce4:-
$ sudo update-alternatives --config x-session-manager
There are 3 choices for the alternative x-session-manager (providing /usr/bin/x-session-manager).Selection Path Priority Status
- 0 /usr/bin/gnome-session 50 auto mode
1 /usr/bin/gnome-session 50 manual mode
2 /usr/bin/startxfce4 50 manual mode
3 /usr/bin/xfce4-session 40 manual modePress to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/xfce4-session to provide /usr/bin/x-session-manager (x-session-manager) in manual mode
Try that
然后应该就可以了。如果不行欢迎留言。
参考文献#
- Ubuntu 20.04: connects, then immediately disconnects #2293
- Setting up RDP with Xfce - kali
- 【工具使用】kali 安装后要做的事情
注:本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可。