通过 xrdp 进行远程桌面:应用程序菜单和指示器小程序中缺少项目

通过 xrdp 进行远程桌面:应用程序菜单和指示器小程序中缺少项目

我按照 Griffon 的指南在 Ubuntu 18.04 上安装 xrdp(http://c-nergy.be/blog/?p=12761),但经过修改/etc/xrdp/startwm.sh以与以下内容一起使用gnome-flashback-metacity

#test -x /etc/X11/Xsession && exec /etc/X11/Xsession
#exec /bin/sh /etc/X11/Xsession
#gnome-session
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check & gnome-panel

我可以从 Windows 客户端(会话:Xorg)登录,但桌面似乎缺少应用程序菜单(特别是终端)中的各种项目以及指示器图标。我可以使用“右键单击主页,在终端中打开”技巧来启动 gnome-terminal。

混乱的 gnome-flashback-metacity

注意:根据过去的经验,我认为这可能与权限有关。但是,我无法判断这是 xrdp 或 GNOME Flashback 的问题,还是我的配置有问题。在物理机上进行常规登录可以正常工作。

当前 /etc/xrdp/startwm.sh:

#!/usr/bin/env bash
#
# This script is an example. You might need to edit this script
# depending on your distro if it doesn't work for you.
#fixGDM-by-Griffon
gnome-shell-extension-tool -e [email protected]
gnome-shell-extension-tool -e [email protected]

if [ -f ~/.xrdp-fix-theme.txt ]; then
echo 'no action required'
else
gsettings set org.gnome.desktop.interface gtk-theme 'Ambiance'
#gsettings set org.gnome.desktop.interface icon-theme 'Humanity'
gsettings set org.gnome.desktop.interface icon-theme 'Ubuntu-mono-dark'
echo 'check file for xrdp theme fix' >~/.xrdp-fix-theme.txt
fi

#
# Uncomment the following line for debug:
# exec xterm


# Execution sequence for interactive login shell - pseudocode
#
# IF /etc/profile is readable THEN
#     execute ~/.bash_profile
# END IF
# IF ~/.bash_profile is readable THEN
#     execute ~/.bash_profile
# ELSE
#     IF ~/.bash_login is readable THEN
#         execute ~/.bash_login
#     ELSE
#         IF ~/.profile is readable THEN
#             execute ~/.profile
#         END IF
#     END IF
# END IF
pre_start()
{
  if [ -r /etc/profile ]; then
    . /etc/profile
  fi
  if [ -r ~/.bash_profile ]; then
    . ~/.bash_profile
  else
    if [ -r ~/.bash_login ]; then
      . ~/.bash_login
    else
      if [ -r ~/.profile ]; then
        . ~/.profile
      fi
    fi
  fi
  return 0
}

# When loging out from the interactive shell, the execution sequence is:
#
# IF ~/.bash_logout exists THEN
#     execute ~/.bash_logout
# END IF
post_start()
{
  if [ -r ~/.bash_logout ]; then
    . ~/.bash_logout
  fi
  return 0
}

#start the window manager
wm_start()
{
  if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
  fi

  # debian
  if [ -r /etc/X11/Xsession ]; then
    pre_start
    export DESKTOP_SESSION=gnome-flashback-metacity
    export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
    export GDMSESSION=gnome-flashback-metacity
    export XDG_SESSION_DESKTOP=gnome-flashback-metacity

    . /etc/X11/Xsession
    post_start
    exit 0
  fi

  # el
  if [ -r /etc/X11/xinit/Xsession ]; then
    pre_start
    . /etc/X11/xinit/Xsession
    post_start
    exit 0
  fi

  # suse
  if [ -r /etc/X11/xdm/Xsession ]; then
    # since the following script run a user login shell,
    # do not execute the pseudo login shell scripts
    . /etc/X11/xdm/Xsession
    exit 0
  fi

  pre_start
  xterm
  post_start
}

#. /etc/environment
#export PATH=$PATH
#export LANG=$LANG

# change PATH to be what your environment needs usually what is in
# /etc/environment
#PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
#export PATH=$PATH

# for PATH and LANG from /etc/environment
# pam will auto process the environment file if /etc/pam.d/xrdp-sesman
# includes
# auth       required     pam_env.so readenv=1

wm_start

exit 1

当前 .xsession:

/usr/lib/gnome-session/run-systemd-session gnome-session-flashback.target

答案1

事实证明这是由于配置不当以及对 GNOME Flashback 环境通常如何初始化的误解造成的。查看相关配置文件 -/usr/lib/systemd/user/gnome-session.service和 后/usr/share/xsessions/gnome-flashback-metacity.desktop,我提出了以下修改来模拟 xrdp 的相同行为:

/etc/xrdp/startwm.sh:

# these global variables are set during normal login through gdm greeter
export DESKTOP_SESSION=gnome-flashback-metacity
export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
export GDMSESSION=gnome-flashback-metacity
export XDG_SESSION_DESKTOP=gnome-flashback-metacity

这些导出应该在之前某处设置. /etc/X11/Xsession(当 xsession 启动时)

〜/ .xsession:

# starting the session through systemd, just like normal login through gdm greeter
/usr/lib/gnome-session/run-systemd-session gnome-session-flashback.target

直接运行gnome-session命令导致指示器图标不显示(类似于Gnome 面板小程序“指示器小程序完成”缺少图标)。因此,尽管已经通过使用 解决了这个问题run-systemd-session,但我还没有确定在正常登录期间启动的部分gnome-panel(包含指示器图标的面板),因此对于 xrdp xsession,我必须将其添加gnome-panel到启动应用程序中。

相关内容