Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$PATH is incorrect while using XRDP #1065

Closed
Abinayasandhiya opened this issue Mar 19, 2018 · 16 comments
Closed

$PATH is incorrect while using XRDP #1065

Abinayasandhiya opened this issue Mar 19, 2018 · 16 comments

Comments

@Abinayasandhiya
Copy link

Abinayasandhiya commented Mar 19, 2018

Hi,

We are using XRDP on Our RHEL6 machine.
Please find below details about our machine:

[root@xxx]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
[root@xxx]$ rpm -qa | grep xrdp
xrdp-0.6.1-4.el6.x86_64
[root@xxx]$ /etc/init.d/xrdp status
xrdp (pid  5095) is running...
xrdp-sesman (pid  5100) is running...

In PuTTY my $PATH is like below:

[root@xxx]$ echo $PATH
/usr/lib64/qt-3.3/bin:/opt/EE_XX/bin/:/opt/APTOdevel/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/opt/bin:/opt/UsageModel:/root/bin

When Our user try to access the server using XRDP $PATH is different so we are facing some environment issue.
Please find below attachment for better understanding.

capture

Can anyone help me it would be grateful.

@metalefty
Copy link
Member

You can reset your PATH by editing startwm.sh as you like.

@Abinayasandhiya
Copy link
Author

Abinayasandhiya commented Mar 20, 2018

Hi,

I have edit the below line in startwm.sh but still i couldn't see PATH correctly.
Please find below line which i edit in startwm.sh:

PATH="/usr/lib64/qt-3.3/bin:/opt/EE_LinXXX/bin/:/opt/APTOdevel/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/opt/bin:/opt/UsageModel"
export PATH=$PATH

Please suggest me on this.

@metalefty
Copy link
Member

Can you show me current your startwm.sh?

@Abinayasandhiya
Copy link
Author

Hi,

I don't know why some letter are getting bold i have attached the file.
PFA.

startwm.sh.txt

@Abinayasandhiya
Copy link
Author

One more information, RHEL7 XRDP is setting PATH correctly.
Issue is only on RHEL6.

@metalefty
Copy link
Member

Surround with ``` or ~~~ when you paste config or log. If massively long, attach is better.

@Abinayasandhiya
Copy link
Author

Yes, Can i give startwm.sh file again.

@metalefty
Copy link
Member

Maybe xrdp on RHEL7 has different startwm.sh from RHEL6's. What about bring it from RHEL7?

@Abinayasandhiya
Copy link
Author

Yes, I guess you are right.

I could see some difference in "/etc/X11/xinit/xinitrc-common" file of RHEL 6 and RHEL 7.

RHEL 7 the file is like below:

# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# xinitrc-common
#
# This is common code shared by both Xsession and xinitrc scripts.  Be sure
# to take this into account when fixing bugs or adding new functionality.

# Set up i18n environment
if [ -r /etc/profile.d/lang.sh ]; then
  . /etc/profile.d/lang.sh
fi

**[ -r $HOME/.profile ] && . $HOME/.profile**

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
userxkbmap=$HOME/.Xkbmap

sysresources=/etc/X11/Xresources
sysmodmap=/etc/X11/Xmodmap
sysxkbmap=/etc/X11/Xkbmap

# merge in defaults
[ -r "$sysresources" ] && xrdb -nocpp -merge "$sysresources"
[ -r "$userresources" ] && xrdb -merge "$userresources"

# merge in keymaps
if [ -r "$sysxkbmap" ]; then
    setxkbmap $(cat "$sysxkbmap")
    XKB_IN_USE=yes
fi

if [ -r "$userxkbmap" ]; then
    setxkbmap $(cat "$userxkbmap")
    XKB_IN_USE=yes
fi

# xkb and xmodmap don't play nice together
if [ -z "$XKB_IN_USE" ]; then
    [ -r "$sysmodmap" ] && xmodmap "$sysmodmap"
    [ -r "$usermodmap" ] && xmodmap "$usermodmap"
fi

unset XKB_IN_USE

# run all system xinitrc shell scripts.
for file in /etc/X11/xinit/xinitrc.d/* ; do
        . $file
done

# Prefix launch of session with ssh-agent if available and not already running.
SSH_AGENT=
if [ -z "$SSH_AGENT_PID" ] && [ -x /usr/bin/ssh-agent ]; then
    if [ "x$TMPDIR" != "x" ]; then
        SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR"
    else
        SSH_AGENT="/usr/bin/ssh-agent"
  fi
fi

CK_XINIT_SESSION=
if [ -z "$XDG_SESSION_COOKIE" ] && [ -x /usr/bin/ck-xinit-session ]; then
    CK_XINIT_SESSION="/usr/bin/ck-xinit-session"
fi

@Abinayasandhiya
Copy link
Author

Abinayasandhiya commented Mar 20, 2018

RHEL 6 the same file is like below:

# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# xinitrc-common
#
# This is common code shared by both Xsession and xinitrc scripts.  Be sure
# to take this into account when fixing bugs or adding new functionality.

# Set up i18n environment
  . /etc/profile.d/lang.sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
userxkbmap=$HOME/.Xkbmap

sysresources=/etc/X11/Xresources
sysmodmap=/etc/X11/Xmodmap
sysxkbmap=/etc/X11/Xkbmap

# merge in defaults
[ -r "$sysresources" ] && xrdb -nocpp -merge "$sysresources"
[ -r "$userresources" ] && xrdb -merge "$userresources"

# merge in keymaps
if [ -r "$sysxkbmap" ]; then
    setxkbmap $(cat "$sysxkbmap")
    XKB_IN_USE=yes
fi

if [ -r "$userxkbmap" ]; then
    setxkbmap $(cat "$userxkbmap")
    XKB_IN_USE=yes
fi

# xkb and xmodmap don't play nice together
if [ -z "$XKB_IN_USE" ]; then
    [ -r "$sysmodmap" ] && xmodmap "$sysmodmap"
    [ -r "$usermodmap" ] && xmodmap "$usermodmap"
fi

unset XKB_IN_USE

# run all system xinitrc shell scripts.
for file in /etc/X11/xinit/xinitrc.d/* ; do
        . $file
done

# Prefix launch of session with ssh-agent if available and not already running.
SSH_AGENT=
if [ -x /usr/bin/ssh-agent -a -z "$SSH_AGENT_PID" ]; then
    if [ "x$TMPDIR" != "x" ]; then
        SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR"
    else
        SSH_AGENT="/usr/bin/ssh-agent"
  fi
fi

CK_XINIT_SESSION=
if [ -x /usr/bin/ck-xinit-session -a -z "$XDG_SESSION_COOKIE" ]; then
    CK_XINIT_SESSION="/usr/bin/ck-xinit-session"
fi

"[ -r $HOME/.profile ] && . $HOME/.profile" line is missing in RHEL6 configuration file.

@Abinayasandhiya
Copy link
Author

I couldn't see any startwm.sh file in RHEL 7.

Red Hat Enterprise Linux Server release 7.4 (Maipo)
[root@XXX xrdp]$ ls
cert.pem         km-0000040b.ini  km-00000414.ini  km-00000807.ini  km-0000100c.ini  sesman.ini
key.pem          km-0000040c.ini  km-00000415.ini  km-00000809.ini  km-00010409.ini  xrdp.ini
km-00000407.ini  km-00000410.ini  km-00000416.ini  km-0000080c.ini  openssl.conf     xrdp_keyboard.ini
km-00000409.ini  km-00000411.ini  km-00000419.ini  km-00000813.ini  pulse
km-0000040a.ini  km-00000412.ini  km-0000041d.ini  km-00000816.ini  rsakeys.ini

@metalefty
Copy link
Member

In RHEL7, startwm.sh is placed somewhere in libexec directory, named startwm-bash.sh.

@Abinayasandhiya
Copy link
Author

Yes, its working thanks for all your help. I have another doubt can you clear that also.

@metalefty
Copy link
Member

What? If your another issue is completely different from this topic, raise another github issue.

@Abinayasandhiya
Copy link
Author

Ok. Thanks for all your help.

@Abinayasandhiya
Copy link
Author

Issue has fixed by add the startwm.sh file of RHEL7.
Thanks metalefty for all you help:).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants