X2Go Bug report logs - #1434
Use login shell for session

version graph

Package: x2goserver; Maintainer for x2goserver is X2Go Developers <x2go-dev@lists.x2go.org>; Source for x2goserver is src:x2goserver.

Reported by: Orion Poplawski <orion@nwra.com>

Date: Sat, 25 Jan 2020 04:20:02 UTC

Severity: normal

Tags: patch

Found in version 4.1.0.3

Full log


Message #5 received at submit@bugs.x2go.org (full text, mbox, reply):

Received: (at submit) by bugs.x2go.org; 25 Jan 2020 04:19:25 +0000
From orion@nwra.com  Sat Jan 25 05:19:16 2020
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,SPF_HELO_NONE,
	URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2
Received: from mail.nwra.com (mail.nwra.com [72.52.192.72])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id E6C045DA92
	for <submit@bugs.x2go.org>; Sat, 25 Jan 2020 05:19:10 +0100 (CET)
Received: from rufous.cora.nwra.com (inferno.cora.nwra.com [204.134.157.90])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client did not present a certificate)
	by mail.nwra.com (Postfix) with ESMTPSA id 7A6BA3403CF
	for <submit@bugs.x2go.org>; Fri, 24 Jan 2020 20:19:07 -0800 (PST)
To: submit@bugs.x2go.org
From: Orion Poplawski <orion@nwra.com>
Subject: Use login shell for session
Organization: NorthWest Research Associates
Message-ID: <939f0e9e-602a-0a1b-b8ae-ff992e3a795d@nwra.com>
Date: Fri, 24 Jan 2020 21:19:03 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.3.0
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="------------ms010902040105010500010605"
[Message part 1 (text/plain, inline)]
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                       orion@nwra.com
Boulder, CO 80301                 https://www.nwra.com/

[smime.p7s (application/pkcs7-signature, attachment)]

Send a report that this bug log contains spam.


X2Go Developers <owner@bugs.x2go.org>. Last modified: Tue Jul 14 20:00:37 2020; Machine Name: ymir.das-netzwerkteam.de

X2Go Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.