# Automically run dialog based shell script on ttyv0 like a kiosk mode



## anxt (Jul 22, 2010)

I am currently automatically execute a script on boot that will run some tests on an embedded device.  My actual goal is to have this menu running 100% of the time without any sort of keyboard input needed, with other ttys disabled.  Not so much for security as to deter the casually curious users from poking around.

So ... I am trying to have the machine, after booting present the user with a console based menu on ttyv0 (using sh and dialog).  The menu runs correctly when started on a (manually) logged in console.

I tried a line like this in /etc/ttys:


```
ttyv5  "/root/test.sh"                 cons25  on secure
```

What I noticed was the script executed (i could see it in ps), but the dialog interaction wasn't on the tty I was looking at (or any tty I could see, for that matter)


As an aside I plan to use:


```
conscontrol mute on
```

to suppress console noise about things being plugged or whatever else and munging the display.

Thanks for any input.  I have been stuck on this for some time now.


----------



## anxt (Aug 10, 2010)

I found this on a mailing list archive which solves my problem.

http://lists.freebsd.org/pipermail/freebsd-questions/2004-March/042040.html

>    Is there a way to auto login on the console when the system boots up.
> So that I can run a script that will provide with a menu to the user
> instead of the login prompt. And also if the script is killed or it dies
> it should respawn.
> Something similar to what /etc/inittab can do in linux.
> I would appreciate any suggestions or solutions.

See ttys(5), getty(8), gettytab(5).  Basically you setup a terminal
type via /etc/gettytab -- copy the 'Pc' entry and append the
'al=username' property -- which causes that terminal to autologin as
the named user. Then you use /etc/ttys to tell the system to run a
getty(8) with that terminal type on a particular tty (the console, or
a vty) -- init(8) scans the /etc/ttys file and will detect when the
associated getty program exits and respawn it.

Set the login shell of the username you select to the program you want
to run on the console, and take steps so that you can't get into that
account by other means, like ftp(1) or ssh(1).


----------

