Git Product home page Git Product logo

nest-systemd-user's Introduction

nest-systemd-user

Runs systemd --user within systemd --user

On systemd-based systems, there is an implicit assumption that the user will only have one graphical session active at any one time. This is because the systemd --user environment is shared between all user sessions, and there is only room for one DISPLAY variable.

This has been of some inconvenience for the xrdp project. A commonly requested feature is for users to be able to log in to the machine console and xrdp at the same time. This is particularly true for lesser-experienced users, maybe using a smaller machine such as a Raspberry PI.

@akarl10 has discovered that is possible to run one systemd --user instance within another. This allows for the possibility of one or more xrdp sessions to use private systemd --user instances. This was announced in xrdp issue #2491.

This repository contains a tool which can be retro-fitted to xrdp v0.9.x installations.

At the moment this is an alpha-quality tool. Feedback and issuea are welcome.

how to use this tool in conjunction with xrdp

To use this tool with xrdp the script startwm.sh should be adapted

First you should place systemd_user_context.sh in the same directory as startwm.sh:-

  • On Fedora or EPEL-based systems, startwm.sh is in /usr/libexec/xrdp/
  • On all other systems startwm.sh is (probably) in /etc/xrdp.

The next step is putting this somewhere near the top of startwm.sh. It can be anywhere in the script as long as it is before the Xsession call

# On systemd system?
#
# If so, start a private "systemd --user" instance
if [ -x /usr/bin/systemctl -a "$XDG_RUNTIME_DIR" = "/run/user/"`id -u` ]
then
    eval "`${0%/*}/systemd_user_context.sh init -p $$`"

    # may be used by reconnect.sh to find the matching logind session
    if [ -n "$XDG_SESSION_ID" ]; then
        echo $XDG_SESSION_ID > $XDG_RUNTIME_DIR/login-session-id
    fi
fi

If you also want to unlock your xrdp screen when you reconnect to your session preventing to type you password twice you might put something like this in reconnectwh.sh

# xrdp-sesman knows nothing about the nested session, so try to guess
# XDG_RUNTIME_DIR
[ -z "$XDG_RUNTIME_DIR" -a -e /run/user/$(id -u) ] && XDG_RUNTIME_DIR=/run/user/$(id -u)

eval "`${0%/*}/systemd_user_context.sh get`"

test -e $XDG_RUNTIME_DIR/login-session-id && \
        loginctl unlock-session $(cat $XDG_RUNTIME_DIR/login-session-id)

nest-systemd-user's People

Contributors

matt335672 avatar akarl10 avatar

Stargazers

6peng avatar

Watchers

 avatar  avatar  avatar

nest-systemd-user's Issues

Test this on RHEL8.9 and RHEL9.4 with xrdp 0.9.20

I try to run this on a test system but it doesn't seem to work. I have copied the file to /etc/xrdp and modified both startwm and startwm-bash scripts but the behavior is still the same.

Reading the snippet code, I don't really understand what does eval "${0%/*}/systemd_user_context.sh init -p $$" is doing. I think this part is not working on RHEL8.9 because if I change to eval "/etc/xrdp/systemd_user_context.sh init -p $$" it seems to work.

Any idea what is wrong there?

And thanks a lot for trying to get around systemd limitations. Going is the direction "no multi user" on Linux anymore is very sad!!

document xrdp integration

Hi

Would it be possible to document how this tool can be retro-fitted to xrdp v0.9.x installations?

Thanks

Konrad

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.