Subject: Bug#1434: Use login shell for session

From: Orion Poplawski <[email-masked]>
Date: Fri, 24 Jan 2020 21:19:03 -0700

Package: x2goserver
Version: 4.1.0.3
Tags: patch

X2Go's Xsession file always starts the user's session with /bin/bash (at 
least on RedHat systems where SHELL is set to /bin/bash via ~/.bashrc 
calling /etc/bashrc).  This patch attempts to determine the user's login 
shell and use that for launching the session.  See also:

  https://bugzilla.redhat.com/show_bug.cgi?id=1794660

Another option might be the judicious use of the --norc option when 
launching x2goruncommand on followers but I'm not sure what other 
effects this will have or where to do that.  Effects might not be to bad 
because I can simulate this by moving away the user's .bash_profile and 
.bashrc files and then the tcsh is used as expected in this case. 
However, while $SHELL does not get set in this case, the xfce4-session 
script still gets launched with bash which triggers some other errors, 
so this patch may be the best option.

---
  x2goserver-xsession/etc/Xsession | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/x2goserver-xsession/etc/Xsession 
b/x2goserver-xsession/etc/Xsession
index 270a0b3..522f37e 100755
--- a/x2goserver-xsession/etc/Xsession
+++ b/x2goserver-xsession/etc/Xsession
@@ -117,6 +117,10 @@ if ! echo "*" >>"$WRITE_TEST"; then
  fi
  rm -f "$WRITE_TEST"

+# Determine the users login shell and use that to launch the session
+SHELL=$(getent passwd $LOGNAME | cut -d: -f7)
+# Fallback
+[ -z "$SHELL" ] && SHELL=/bin/bash

  if [ -f /etc/debian_version ] || [ -f /etc/devuan_version ]; then

--
1.8.3.1

-- 
Orion Poplawski
Manager of NWRA Technical Systems          720-772-5637
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       [email-masked]
Boulder, CO 80301                 https://www.nwra.com/