What would happen if there were multiple active users at the same time (like with Screen Sharing, where the local GUI user and a remote user can both have active sessions)? Or with a local GUI user and another user SSH’d in?
That is a very good point.
I am trying to solve a problem with a tokend (part of CDSA) used by Safari and Mail. So a SSH session (text only) is not an issue for me.
A remote user starting a graphical session would be a problem. I will check that to see what happens in this case.
I think I can consider this as a known limitation of my solution.