You are not logged in.
Pages: 1
Hello,
I am running dwm as window manager.
I usually execute dwm through .xinitrc and start x manually by giving the command "startx".
However, I tried to startx automatically by adding the lines described in archwiki to ~/.bash_profile and it works fine (as soon as login id and password is given, dwm is launched)
But when I quit dwm (using alt+shift+q), it does not return to tty as before (before configuring X to start automatically), instead it goes back to the login prompt.
How can I make it to return to the terminal (tty) after exiting dwm?
Thanks,
Last edited by thinkanish (2022-05-16 15:42:51)
Offline
That's a security hole; are you sure you are comfortable with that? If so, see: https://wiki.archlinux.org/title/Getty# … al_console
Offline
Hi,
Thanks for your reply.
Can you please explain how it is a security hole?
Because, usually, when I use startx to start dwm, when I quit dwm using shift+alt+q, it returns to the tty.
How is this different? I mean I just only automated the first part (startx)
Offline
It means if X crashes (or is killed), you have an authenticated prompt. That may be fine; I don't know what your risk profile looks like, but for me that is a no-go.
Offline
The difference is that you probably now "exec startx" which replaces the login shell - so you can't return to it.
If you don't, you do not even have to killcrash or zap X11, you can just ctrl+alt+f1 yourself from a locked X11 session into an open shell, so make sure to at least re-use the VT, https://wiki.archlinux.org/title/Xinit#xserverrc
Offline
Hi Seth,
It makes a bit of sense now. Yes. In the .bash_profile I added "exec startx"
But when normally starting X, we just run "startx" - so in this case, the login shell is not replaced? the login shell is treated as a parent and the X window is spawned from it?
Offline
Offline
Thanks.
If command is specified, exec shall not return to the shell;
rather, the exit status of the process shall be the exit status of the program implementing command, which overlaid the shell.That explain it pretty well.
thanks again guys for your time and comments.
Offline
Hello,
After trying different commands, I have few more doubts :
When I use exec command in .bash_profile as,
exec startxdwm automatically starts after the login (since dwm is started in .xinitrc). And when I quit from dwm using (ctrl+alt+q), it comes back to login screen (logs out the user).
But when i just use the command
startxin .bash_profile, then it starts dwm and upon using (ctrl+alt+q), it returns to the tty (which is logged in to current user).
I understand that this is due to the exec command used as mentioned by seth.
My question is,
In what way the second method, using startx without "exec" is dangerous? (as Jason mentioned that there is a security hole)
Thanks.
Offline
If you don't, you do not even have to killcrash or zap X11, you can just ctrl+alt+f1 yourself from a locked X11 session into an open shell, so make sure to at least re-use the VT, https://wiki.archlinux.org/title/Xinit#xserverrc
Offline
Okay. So, if I understand properly, If I don't use exec, then even when the display is locked, another tty can be used to login to the screen.
Now, If I use exec, it replaces the tty and jumps to the WM and when I quit the WM, it comes back to the login shell - here I have a problem of not able to shutdown the machine. So, I should use some method from inside the WM itself to shutdown the machine is it?
Like running the shutdown terminal inside a terminal inside the WM? Or is there another way to shutdown the system?
Offline
If I don't use exec, then even when the display is locked, another tty can be used to login to the screen.
No. That's always the case and not a threat.
Edit: the point is the risk that there is an open shell already that is then accessible despite the GUI session being locked.
If I use exec, it replaces the tty and jumps to the WM and when I quit the WM, it comes back to the login shell
Yes.
here I have a problem of not able to shutdown the machine
What? Your xinitrc is likely broken, see the notes in the last link below.
You can shutdown directly from the GUI session, terminating that just to get to a console login just to be able to shutdown is madness.
I should use some method from inside the WM itself to shutdown the machine is it?
Yes.
Or is there another way to shutdown the system?
"systemctl poweroff" or "systemctl reboot"
In a properly setup (active) session, you can run that from any terminal or a shortcut or a fancy panel button or a context menu entry.
Last edited by seth (2022-05-16 11:50:44)
Offline
Thanks much for your inputs!
I understand it better now.
Offline
Pages: 1