running graphical session under login shell in debian

To run an X session started from a display manager under a login shell for the user, one can create the following in /etc/X11/Xsession.d/99x10-start-under-login-shell :


# We get sourced by Xsession, which is interpreted by sh.

echo about to attempt to exec $SHELL -l -c \"$STARTUP\" >&2

exec $SHELL -l -c "$STARTUP"

which is pretty hacky but "works".

Twenty years ago, when I was in a team managing workstations running SunOS, Solaris, Irix, and Red Hat, the dotfiles worked the same on all, without having to change anything.  The users' c shell or bourne (posix) shell init was run, as a login shell (which one depended on their configured shell per getent passwd), with the whole session then being a subtree in the process tree of this login shell.

I'm not exactly sure which "modern" linuxes fail to do this properly, but it doesn't take a genius in design to see that if (i) ssh-ing gives a login shell, and (ii) logging in on the console gives a login shell, then (iii) the nicest thing for the user is if a DM-launched session is under a ... login shell.  Then they still get all their environment and stuff, in a consistent way.

I used to package up the above solution as a debian package [0] but fell out of the habit, so now it's a few lines to add ad-hoc or via whatever config management system one is using.

[0] <https://github.com/tomgjones/xsession-run-login-shell>

Comments

Popular posts from this blog

the persistent idiocy of "privileged ports" on Unix

google is giving more and more 500 errors

Guernsey Waste in incorrect bag-rejection horror May 6th, 2024