Is it possible to make a script run every time any user logs in on a Linux operating system? I figured out that if every single user uses bash it's possible to get bash to do this for me by putting the script in /etc/profile.d/, but some of the users don't use bash, so the script will not run when they log in. I mean when a user logs in at all, not when a shell or a desktop environment starts.

I don't want to get GNOME or Plasma to do this with their autostart stuff because this is a headless server & it does not have a desktop environment. I also don't want this to depend on users having a specific shell set or requiring them to manually run the script when they log in. I thought systemd was capable of handling this, but after doing some research it seems like it does not have the ability to detect logins & start services on login, only at boot & once dependencies are met or at specific intervals of time.

Even better if there's a way to get it to run before the login every time someone logs in.

#Linux