You are not logged in.

#1 2012-08-22 13:58:51

sediment
Member
Registered: 2012-08-01
Posts: 20

Conditional auto-login?

I'm not altogether sure that this is in the right forum, but I don't know where would be more appropriate for it.

I'd like to arrange for Arch to automatically log in to a particular account on boot, but only if a certain condition is met. (To be specific, I'd like it to log in only if there isn't a keyboard plugged into the computer. My reason for doing this is that I make electronic music with my computer, and I'd like to be able to set it up at concerts just by turning it on, without needing to connect a keyboard (or monitor, or mouse...))

Does anyone know whether this is possible, or how I would go about doing it, if so? Incidentally, I've already figured out some bash code to check if the keyboard is present or not. I just have no idea where to put this so that it will then be able to login for me.

Thanks in advance.

Offline

#2 2012-08-22 14:03:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Conditional auto-login?

Do you mean log in to a different WM/DE (or none at all), or do you mean log in as a different user account?

If you're looking for the former, check out this thread.

If you want the latter, I don't have any great ideas, but one kludge that would work is to autologin to any user you'd like: root would work, or create an additional user just for this purpose.  In that user's bashrc you can have your code to test for the keyboard and run an `exec login ...` command passing the appropriate username and arguments.

Last edited by Trilby (2012-08-22 14:04:25)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2012-08-22 14:13:46

sediment
Member
Registered: 2012-08-01
Posts: 20

Re: Conditional auto-login?

I should have specified that it's the latter. I don't want to log in to X or any kind of window manager, just into the shell, on one of the ttys, I guess. I'll have a few scripts to execute in the .bashrc. Your kludge seems feasible - may give it a try, but seems like this would disturb my normal login procedure for other purposes?

Offline

#4 2012-08-22 14:15:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Conditional auto-login?

You can put it all in a conditional block to test which tty it is on, and that it is not in X - so that all this only runs when you want it to, and is ignored in other situations.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2012-08-22 14:26:18

sediment
Member
Registered: 2012-08-01
Posts: 20

Re: Conditional auto-login?

Oh, I see. I was misunderstanding you at first. I think something like your method should work - I just didn't spot that you could set up inittab to log in to accounts on a per-tty basis. I think I'll try having the account always autologin on tty6 or whatever, then do its conditional checks, and either proceed or logout (or perhaps just do nothing) accordingly. Thanks.

Offline

Board footer

Powered by FluxBB