Automatically Closing Local Session During Remote Connection on Plasma #3269
Unanswered
steven12138
asked this question in
Q&A
Replies: 1 comment
-
This is a problem on systemd-based systems. See the FAQ. If at all possible, use a different user for xrdp and the console. That's the official advice for such systems. If not, this might work for you. I've not tested it on arch. Create a script #!/bin/sh
# Check for a systemd installation
if ! [ -x /usr/bin/loginctl ]; then
exit 0
fi
# Need zenity to prompt the user
if ! command -v zenity >/dev/null; then
echo "** zenity not installed" >&2
exit 0
fi
status=0
seat_list=""
session_list=""
for session in $(loginctl show-user "$(id -un)" -p Sessions --value); do
seat="$(loginctl show-session "$session" -p Seat --value)"
if [ -n "$seat" ]; then
seat_list="$seat_list $seat"
session_list="$session_list $session"
fi
done
if [ -n "$seat_list" ]; then
seat_list="${seat_list# }" ;# Remove leading ' '
zenity --display="$DISPLAY" --question \
--text='Seat(s) "'"$seat_list"'" are active for this user\nDo you want to kill them?\nIf you do not, this xrdp session will terminate.'
status=$?
if [ $status -eq 0 ]; then
# 'Yes' pressed
# shellcheck disable=SC2086
loginctl terminate-session $session_list
status=$?
fi
fi
exit $status Make sure the script is owned by root, and executable. Within # Check the console isn't logged in
/etc/xrdp/kill_seats.sh || exit $? Then install zenity. On my test machine running 22.04, I needed to use CTRL-Alt-F1 on the console to get the login box back after terminating a console session. I have no idea why. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When remotely connecting using Plasma 6.1.5 on Arch Linux with xrdp version 0.10.0, if the local session is still active (not logged out), the remote connection displays a black screen with a cursor, while some newly opened windows appear in the remote session. I want to automatically close the local session (X11 or Wayland) when initiating a remote connection. Is this possible, and if so, how can it be achieved?
I tried
but its not what I'm expected
I tried follow:

#3001
and remove the '.' character in
and here is my
~/.xinitrc
Beta Was this translation helpful? Give feedback.
All reactions