Tuesday, September 23, 2014

A nicer alternative to init=/bin/sh

My thanks to the Gentoo guys for showing succintly how to solve the whole "/bin/sh: can't access tty; job control turned off" problem when booting directly into a shell.  With that and a call to /etc/init.d/rc, I got myself a simple script to automatically login as root into runlevel S and stay there permanently:
/etc/init.d/rc S

while true; do
    setsid sh -c 'exec login -f root </dev/tty1 >/dev/tty1 2>&1'

No comments: