xrdp從Windows10/Centos連接到Centos7後立即斷開連接

xrdp從Windows10/Centos連接到Centos7後立即斷開連接

這是我的 xrdp 配置:

[Globals]
ini_version=1
fork=true
port=3389
use_vsock=false
tcp_nodelay=true
tcp_keepalive=true
security_layer=negotiate
crypt_level=high
certificate=
key_file=
ssl_protocols=TLSv1.2, TLSv1.3
autorun=
allow_channels=true
allow_multimon=true
bitmap_cache=true
bitmap_compression=true
bulk_compression=true
max_bpp=128
use_compression=yes
new_cursors=true
use_fastpath=both
blue=009cb5
grey=dedede
ls_top_window_bg_color=009cb5
ls_width=350
ls_height=430
ls_bg_color=dedede
ls_logo_filename=
ls_logo_x_pos=55
ls_logo_y_pos=50
ls_label_x_pos=30
ls_label_width=65
ls_input_x_pos=110
ls_input_width=210
ls_input_y_pos=220
ls_btn_ok_x_pos=142
ls_btn_ok_y_pos=370
ls_btn_ok_width=85
ls_btn_ok_height=30
ls_btn_cancel_x_pos=237
ls_btn_cancel_y_pos=370
ls_btn_cancel_width=85
ls_btn_cancel_height=30
[Logging]
LogFile=xrdp.log
LogLevel=DEBUG
EnableSyslog=true
SyslogLevel=DEBUG
[Channels]
rdpdr=true
rdpsnd=true
drdynvc=true
cliprdr=true
rail=true
xrdpvr=true
tcutils=true
[Xvnc]
name=Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1
[Xorg]
name=Xorg
lib=libxup.so
username=ask
password=ask
ip=127.0.0.1
port=-1
code=20

我正在嘗試使用 mstsc 連接到這台機器(這是在電腦重新啟動後,沒有人登入):

在此輸入影像描述

在此登入框中,不會發生斷開連線:

在此輸入影像描述

輸入正確的登入名稱/密碼後,我首先出現黑屏,然後 mstsc 視窗關閉。我嘗試從 KDE 遠端連接應用程式進行連接,但也以相同的方式失敗。 xrdp.log 似乎不包含任何有趣的內容:

[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
[20190606-04:14:36] [INFO ] xrdp_wm_log_msg: sesman connect ok
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
[20190606-04:14:36] [DEBUG] return value from xrdp_mm_connect 0
[20190606-04:14:36] [INFO ] xrdp_wm_log_msg: login successful for display 10
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC started connecting
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC connecting to 127.0.0.1 5910
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC tcp connected
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC security level is 2 (1 = none, 2 = standard)
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC password ok
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC sending share flag
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC receiving server init
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC receiving pixel format
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC receiving name length
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC receiving name
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC sending pixel format
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC sending encodings
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC sending framebuffer update request
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC sending cursor
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: VNC connection complete, connected ok
[20190606-04:14:36] [DEBUG] xrdp_wm_log_msg: connected ok
[20190606-04:14:36] [DEBUG] xrdp_mm_connect_chansrv: chansrv connect successful
[20190606-04:14:36] [DEBUG] Closed socket 18 (AF_INET 127.0.0.1:47744)
[20190606-04:14:37] [DEBUG] Closed socket 20 (AF_UNIX)
[20190606-04:14:37] [DEBUG] Closed socket 12 (AF_INET 127.0.0.1:3389)
[20190606-04:14:37] [DEBUG] xrdp_mm_module_cleanup
[20190606-04:14:37] [DEBUG] VNC mod_exit
[20190606-04:14:37] [DEBUG] Closed socket 19 (AF_INET 127.0.0.1:40224)

我該如何解決這個問題?

答案1

嘗試這個:

停止 xrdp sudo service xrdp stop

編輯 xrdp 啟動腳本: sudo nano /etc/xrdp/startwm.sh

在此文件中,替換行

test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

startxfce4

#(您可以透過在開頭新增來註解掉行)

重新啟動 xrdp sudo service xrdp start

選擇 Xrdp 作為會話,然後登入。

答案2

我自己解決了這個問題,希望其他人會發現它有用。我看了一下~/.xsession-errors,它包含:

(imsettings-check:16467): IMSettings-WARNING **: 04:42:56.491: Could not connect: Connection refused

(imsettings-check:16467): GLib-GIO-CRITICAL **: 04:42:56.491: g_dbus_proxy_call_sync_internal: assertion 'G_IS_DBUS_PROXY (proxy)' failed
GLib-GIO-Message: 04:42:56.807: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.

** (process:16260): WARNING **: 04:42:56.824: Could not make bus activated clients aware of XDG_CURRENT_DESKTOP=GNOME environment variable: Could not connect: Connection refused

然後我用谷歌搜尋了根本原因,miniconda 安裝破壞了 .bashrc 檔案中的 PATH,我有已刪除這條線已經修復了:

    export PATH="/home/stiv/miniconda3/bin:$PATH"

更新:後來我發現x2go,其運作方式比 XRDP 更可靠、更快速。

答案3

  1. sudo apt-get update

  2. sudo apt install xrdp

  3. sudo apt-get install xserver-xorg-core

  4. sudo apt-get install xorgxrdp

  5. nano /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf

  6. 將下面的 polkit 複製到02-allow-colord.conf

polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.color-manager.create-device" || action.id == "org.freedesktop.color-manager.create-profile" || action.id == "org.freedesktop.color-manager.delete-device" || action.id == "org.freedesktop.color-manager.delete-profile" || action.id == "org.freedesktop.color-manager.modify-device" || action.id == "org.freedesktop.color-manager.modify-profile") && subject.isInGroup("{group}"))
{
return polkit.Result.YES;
}
});
  1. sudo ufw allow 3389/tcp

  2. sudo /etc/init.d/xrdp restart

  3. sudo systemctl status xrdp

  4. sudo systemctl enable xrdp

  5. 退出您的會話。

  6. 嘗試使用 RDP

答案4

您必須執行以下附加操作:

要配置 Xrdp,首先新增

exec gnome-session

到設定檔末尾

/etc/xrdp/xrdp.ini

或使用以下命令將“exec gnome-session”新增至“/etc/xrdp/xrdp.ini”設定檔的末尾

sudo bash -c 'echo "exec gnome-session" >> /etc/xrdp/xrdp.ini'

重新啟動 xrdp 以載入新配置

sudo systemctl restart xrdp

參考: 如何:在 CentOS 8 上安裝 Xrdp(遠端桌面) – (如何:使用 Windows 遠端控制 CentOS 8)

相關內容