You are not logged in.

#1 2025-06-20 19:18:05

hanss
Member
Registered: 2025-06-16
Posts: 20

[SOLVED] Simple password protection when switching graphical sessions?

I am looking for some recommendations because it has been a long time since I used a desktop environment or set up more than one user account. I normally log in to a virtual console and run startx manually and my X install is close to stock other than setting up some keybindings and executing xmonad from .xinitrc.

I recently added some more user accounts for my kids and was surprised to find that I can get multiple graphical sessions simultaneously by simply switching to a different virtual console, logging in as a different user, and running startx. If I remember correctly 10+ years ago doing that didn't work at all or would lead to subtle problems. Of course anyone can switch to anyone else's session just by hitting ctrl-alt-Fn without entering a password, but other than that it seems to accomplish what I want. So first question, other than the lack of password protection, are there any potential problems with doing it this way?

Second question, what it the simplest way to add password protection to user switching that will play nicely with my existing setup? Is installing a display manager the obvious way to do it, or is there something simpler?

Last edited by hanss (2025-06-22 01:01:52)

Offline

#2 2025-06-21 11:45:48

seth
Member
Registered: 2012-09-03
Posts: 65,058

Re: [SOLVED] Simple password protection when switching graphical sessions?

If I remember correctly 10+ years ago doing that didn't work at all or would lead to subtle problems.

This has pretty much always worked to the degree where your hardware allowed it -the "subtle" in "subtle problems" of course give you a lot of wiggle-room, here wink

are there any potential problems with doing it this way?

user accounts for my kids

Though unless some process caches sensitive porn in unprotected paths like /tmp or your kids just push the power button (they can also properly shut down the system) and of course will leave a sticky keyboard behind - you do not expect systematic technical issues (so doing this between two friendly adults isn't a problem)

Second question, what it the simplest way to add password protection to user switching

Just trigger a screen locker? (slock, i3lock, stuff like that)

Offline

#3 2025-06-21 15:13:18

hanss
Member
Registered: 2025-06-16
Posts: 20

Re: [SOLVED] Simple password protection when switching graphical sessions?

Ah, yes, it hadn't occurred to me that screen locking could be done independently per session with and that screen lockers would exist as standalone programs. That sounds perfect, thank you. To make sure I understand correctly how this would work: each user is responsible for locking their session when they leave but the screen locker doesn't prevent you from ctrl-alt-Fn switching to unlock a different session while the others are still locked?

Offline

#4 2025-06-21 15:18:30

seth
Member
Registered: 2012-09-03
Posts: 65,058

Re: [SOLVED] Simple password protection when switching graphical sessions?

To make sure I understand correctly how this would work

"Yes", the VT switch is done by the kernel.
Just be mindful if you're on X11 and have features like zapping enabled (ctrl+alt+backspace kills the server) and also of DOS attacks via faillock (though the root can always log in an clear everyones faillock status)

Offline

#5 2025-06-21 15:42:25

hanss
Member
Registered: 2025-06-16
Posts: 20

Re: [SOLVED] Simple password protection when switching graphical sessions?

seth wrote:

Just be mindful if you're on X11 and have features like zapping enabled (ctrl+alt+backspace kills the server) and also of DOS attacks via faillock (though the root can always log in an clear everyones faillock status)

Ha, if my kids figure out how to do anything like this I think I'll consider it a success. Thanks for the advice.

Offline

#6 2025-06-21 20:12:52

seth
Member
Registered: 2012-09-03
Posts: 65,058

Re: [SOLVED] Simple password protection when switching graphical sessions?

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Edit: I was 5 when I had more control over our TV than my parents. Don't be too confident here lol

Last edited by seth (2025-06-21 20:15:16)

Offline

#7 2025-06-22 01:00:17

hanss
Member
Registered: 2025-06-16
Posts: 20

Re: [SOLVED] Simple password protection when switching graphical sessions?

I tried slock first but with multiple users it gets confusing not knowing whose plain black lock screen you're looking. I ended up using i3lock with an image generated automatically in system-wide xinirc:

magick -size 1920x1080 -background black -fill gray -gravity center -pointsize 72 label:$(id -u -n) ~/.lockscreen-image.png

I thought it would be nicer to just generate the image on the fly like:

i3lock -i <(magick -size 1920x1080 -background black -fill gray -gravity center -pointsize 72 label:$(id -u -n) PNG:-)

But that doesn't work:

Could not load image "/dev/fd/63": error occurred in libpng while reading from or writing to a PNG file

The same process substitution with the ImageMagick display utility works fine so I'm not sure what's wrong, maybe because i3lock forks?

Offline

#8 2025-06-22 05:23:29

seth
Member
Registered: 2012-09-03
Posts: 65,058

Re: [SOLVED] Simple password protection when switching graphical sessions?

Offline

#9 2025-06-23 02:40:13

hanss
Member
Registered: 2025-06-16
Posts: 20

Re: [SOLVED] Simple password protection when switching graphical sessions?

i3lock-color worked nicely using --greeter-text to show the username but I decided to investigate why piping didn't work with standard i3lock and it was simply not enough RTFMing on my part. Have to use raw format like:

magick -size 1920x1080 -depth 8 -background gray -fill black -font Source-Code-Pro -pointsize 72 -gravity north label:$(id -u -n) RGB:- | i3lock --raw=1920x1080:rgb --image=/dev/stdin

So I decided to go back to standard i3lock to avoid AUR.

Offline

Board footer

Powered by FluxBB