Server Login Program

I have a bare bones CLI server where would I place a bash program written with dialog (ncurses based) that has a TUI login program?

People always appreciate if you tell which version of openSUSE you use.

And who knows, that basic information might even be needed to create a correct answer.


Is there anything specific about that script? Executables should be placed in PATH (besides having the executable bit) which you can see with the output of

echo "$PATH"


man hier 

is mentioned somewhere here in the forums that might also shed some light.

I’m going to use 13.2, and the code will just be passing strings using the dialog command or I have found a login program that looks something like this](

If anyone is needing some references on another login program here is one that I wrote in bash.


USERNAME=$(whiptail --title "Login" --inputbox "Enter the Username" 10 60 root 3>&1 1>&2 2>&3)

if  $exitstatus = 0 ]; then
            PASSWORD=$(whiptail --title "Login" --passwordbox "Enter your password and choose Ok to continue." 10 60 3>&1 1>&2 2>&3)

                if  $exitstatus = 0 ]; then
                         echo "Your password is:" $PASSWORD
                         echo "You chose Cancel."
    echo "You chose Cancel, retrying login script"
    #Redo script

It maybe me, but I do not realy understand what you want. Do you want to replace the standard login program (and thus process) on the console to be replaced by one of your own design?

Yes, that’s what exactly what I’m asking.

It looks like an interesting exercise.

I have no idea how far you went in researching how it should work and what is minimal needed to implement it. I see two principal ways of replacing the current login:

  1. replacing /bin/login by a program of your own;
  2. or replacing the call of login by a call to a program of your own, I am not sure where to do this, but I assume that on of the systemd starts contains the starting of login on every tty configured as such.


man login

one finds not only how to call login, but also what login should do. And while it may be true that you need not everything there in your situation, I do not see anything of it in your script. E.g., I see nowhere what is started on successful login. Also, not providing all things that are mentioned as a must could lead to severe problems (no login whatever prossible) when the system gets into problem and offers an emergency login.

I have in fact no idea where your script fits in this.

Yea that’s what I’m looking at right now. Hmmm, I could probably invoke a autologin then just pass a script after login that will just run the ncurses login. However I want the passwords and usernames to be synced with the usernames/passwords within the OS.

Well this is not a trivial exercise. Get the source codes of the current one and study how it is done there. Or start from there and add your curses code

So what if I just wanted to run something like lightDM then after that it just goes to the console prompt?

Might work but again you gotta dig into the source code for what you want. Maybe someone has done something like this but It may also not be trivial. The beauty of open source is you can do anything you want with it because you have access the source. So you can look at other code to see how they did it then maybe modify it to do what you want.

True that. I’ll look into it more.

I fail to see why two logins are necessary. I still have the idea that you did not realy informed us about what you try to achieve and why. Trying to help you is more then throwing ansers to you about some minor point of your quest. In fact I see this as another case of

Gogalthorp expresses himself a bit more strongly then I did. I called it only “interesting”, but I am fully with him, it is not trivial.

And I assume you know where userids, usernames and encrypted passwords are stored. So syncing is as trivial as using the same files.

I really don’t want two logins, I want to ease the “look and feel” when someone logs into a Linux console. I’m trying to create a Small Business Distro from openSUSE that will be almost fully automated when it comes to launching infrastructure applications. However I want to mitigate as much memory as possible, thus I’m opting for the regular terminal. However it is full of dread for any normal user, so that’s why I’m opting for a ncurses based loging, so then after that there will be a ncurses based management console. Although I’m not looking for a “Do 1. 2. 3. this and this, change X.” I like doing this on my own and with some help along the way. Anyhow, I hope this is some help to you on my objectives. :slight_smile:

Perfect program is midnight commander (mc) It is not installed by default but it has a great intuitive interface and includes a simple editor. Almost all admin work can be done from it assuming you know how to admin :stuck_out_tongue: So you could chain from the login screen to mc

Thus when I am correct, your script is not something based on any example or documentation.
In fact I am having a sort of sleepness night on constructs like

3>&1 1>&2 2>&3

What are you trying to achieve with this?


if  $existstatus = 0 ]
then    ....

can be repaced by

if program
then ...

There is no pressing need to do so, but I get the idea you do not quite understand how return codes and the conditional statements function.