I created a script that, when executed, leaves the user with a blank screen where he can only type, much like a typewriter. It's a Python script, and I intend to port it to pure Bash eventually.

Now I want to generate a LiveUSB where this script runs at startup, and the one and only thing you can do when you boot is type text (and of course you should be able to turn off the system somehow). I don't even want any GUI, or any way for the user to bypass this "home screen". I want it to be a single-purpose, "Kiosk mode" CLI environment. This is similar to PyRoom, only at the level of the OS and without a GUI.

So the question is (and I am not quite experienced with boot configuration): what would be the typical steps do achieve that? Where should I put the script, and how do I tell the booting system to run it right away at startup?


You can set up automatic login to the terminal by messing with the options to the getty program; if you use agetty, you add --autologin <username>, as shown here.

You can then set that user's login shell to whatever you like. It should not be listed in /etc/shells so that the user can't change it with chsh. Assuming you want security against the user getting to a normal shell (and thus being able to do arbitrary things), you need to ensure that they can't get there from within your program. If your program is the login shell, then quitting will just end the session and drop back into getty (which will then presumably autologin you again back into the same program).


You can replace init with a simple program that runs your script. I set up an Ubuntu 15.04 VM and wrote this simple program, saved as init.c:

int main() {
  system("/bin/bash -c /init.sh");
  return 0;

and a simple script:

echo Start:
while read line; do
  echo -n "Upside down: "
  echo $line | tr '[unbqdphymwaefjg]' '[nuqbpdyhwmeajf6]'
init 0

and compiled and installed it as root (make sure you do this in a VM that you've snapshotted, or otherwise know how to fix your system):

gcc init.c -o init
sudo cp init /init
sudo ln -sf /init /sbin/init
sudo cp init.sh /init.sh

and rebooted, and I get my prompt and no easy way to break out.

enter image description here

You should be able to combine that with the OEM installer and remove a bunch of the unnecessary stuff, and make a nice small ISO.

  • I would recommend against this method, as it would break all kinds of things. The system would lack any kind of functionality, since you remove any possibility of initialization. – Wouter Verhelst Oct 23 '15 at 6:43
  • @WouterVerhelst - thats ridiculous. – mikeserv Oct 24 '15 at 0:23
  • @mikeserv, no it isn't, although rereading I'll grant you that it's inaccurate. What I meant was that you'll lose many things, like network, remote management, updates, sound, the ability to mount any filesystem other than the root one, etc etc etc. That's a pretty high price to pay, especially in the knowledge that there are other ways to do this (e.g., custom shell and auto login). – Wouter Verhelst Oct 24 '15 at 9:27
  • @WouterVerhelst - you dont have to lose any of that. you dont remove any possibility of initialization - instead you merely rein it in. why would you initialize any of that if all you wanted was exec cat anyway? granted, i consider just setting the init= kernel parameter a little more simple than the suggestions herein - especially in that the same initramfs can be used with a regular boot and with the kiosk stuff and boot the same system without hassle, but its silly to suggest that not doing stuff that isnt wanted is somehow detrimental. – mikeserv Oct 24 '15 at 10:18
  • @WouterVerhelst if you want things like networking and hotpluggable USB drives or printers, I'd really recommend picking a Desktop Environment with a kiosk mode: /etc/network/interfaces and udev are a real PITA if you don't already know what you're doing, and the DEs all streamline that for you (e.g. network-manager). I got the impression OP didn't, which is why I thought this technique (actually an expansion on the linked answer) made sense. But, this is where Stack Exchange shines: put out alternatives and let the community vote up & down! – drewbenn Oct 26 '15 at 5:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.