You are not logged in.
When I'm in an i3 session, the terminals I open start me in the user's shell as per login manager (LightDM). If I switch to root however, and back again to session user, it doesn't carry over the "DISPLAY environment variable". I get
Error: no DISPLAY environment variable specifiedas output when I try to open GUI. From there, I need to either open a new terminal or manually set the variable with
export DISPLAY=:0. How can I switch between users within terminal without messing up this setting? Thanks.
Last edited by mac41 (2023-06-23 05:49:14)
Offline
If I switch to root however, and back again to session user...
This is the only relevant part of the issue - we need to know a lot more about this. If you 'su' to root, then exit that su'ed session, you would still have the environment in place. If you switch user to root, then nested within that root session open a new user session, then whether or not the environment is preserved could depend on the tools used to switch user (su / sudo ...) and the flags / options given to those tools. However this is not likely that relevant, as you really should not open a new user session nested within the root session. This would give a false sense of security that would be trivially easy for a malicious script / code to take advantage of to regain root access. So if you are running user shells nested under an active root shell, you are doing it wrong in the first place.
Last edited by Trilby (2023-06-22 15:31:59)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
If you switch user to root, then nested within that root session open a new user session, then whether or not the environment is preserved could depend on the tools used to switch user (su / sudo ...) and the flags / options given to those tools. However this is not likely that relevant, as you really should not open a new user session nested within the root session.
Well, that explains everything. I was indeed opening user sessions nested within root session ("su - user" instead of "exit"); I did not know about know about this nested session stuff in the first place. Not only am I doing things wrong, but disastrously so. Thank you for the feedback, and apologies for lack of relevant details.
Last edited by mac41 (2023-06-23 06:39:09)
Offline