0

I have a system that runs a bash script when it starts (I use /etc/init.d/rc.local to execute it without needing to log in).

For reasons I won't go in to here, I need to launch a graphical terminal to run the script. It does things like display diagnostic messages while starting an application. The way I start everything in rc.local is like this

xinit urxvt --hold -e /path/to/script

After doing all its diagnostic stuff, the script launches a full screen application. When that application dies (for whatever reason) the user gets dropped back at the urxvt terminal exactly where the script left off before launching.

What I would like to happen is that when the application dies, the script launches a new urxvt terminal with a login prompt. I have tried urxvt --ls and urxvt --loginShell but every time the new terminal is launches, I get a shell with the root user logged in - obviously not idea.

How can I make it launch a login prompt with no user logged in?

  • "login shell with no user logged in" makes no sense: what user would the shell be running under? Anyway, I don't understand very well what you want to do but maybe you could accomplish it by having the script start a login shell with su as the last thing it does? I don't understand at all why you need a new instance of urxvt as this point: you need the shell to display in a different window than the application did? – Celada Jul 25 '14 at 1:15
  • If I understand correctly, a login shell is one that displays a login prompt. Thats what I want to happen after the process launched by the script dies. Instead of being dropped back at the existing terminal running the script, they should be presented with a login prompt. I've tried using su - but since it is being run by root (since the script is run by root) it just starts a prompt like root@localhost:~$ – Cameron Ball Jul 25 '14 at 1:20
  • Also a new instance of urxvt is not necessarily needed. – Cameron Ball Jul 25 '14 at 1:22
  • The definition of a login shell is not an application that displays a login prompt. A login shell is a shell that reads the login-time initialization scripts like /etc/profile at startup time. If you want a login prompt, then run login, not a shell. – Celada Jul 25 '14 at 1:25
  • 1
    I believe you’re saying that you have a function (I’m using that term in a generic sense) that you start at system boot time, through /etc/init.d/rc.local, and, as a result of running that function, the system presents an interactive shell prompt to the user when it boots. If that’s it, you need to simply exit from the thing you are running from rc.local, and let the system take care of the login dialog. If you’re starting an X session, that means you need to terminate the X session. (Or are you saying that you want a different login dialog from the one the system normally uses?) – Scott Jul 25 '14 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.