Plugh

What is it?

plugh is a much-hacked getty for people who want to have a shell running all the time on some tty. It sets up the terminal, writes accounting information to utmp and wtmp, then becomes the user and runs their shell without (hopefully) any fuss, muss, or bother.

plugh takes 4 arguments: user, tty, gettydefs type, and terminal type. The gettydefs type is VC for console gettys and the line speed for serial lines and modems. The tty is one of the ttys in /dev – you do NOT supply the leading /dev, because plugh will add that for you. The terminal type is what you’d expect – linux for the console, and whatever sort of serial terminal you’ve got for serial lines.

To run plugh, edit lines in your /etc/inittab to call plugh instead of getty. If you’re running a Mastodon system and use ogetty, you’d replace

m:respawn:/sbin/getty      ttyc VC linux<

with

m:respawn:/sbin/plugh orc ttyc VC linux

to have the user “orc” constantly logged into ttyc (ALT-F12)

NOTE: This code has not been reviewed to ensure that it isn’t a heaping plate of security violations. If you allow other people to use your system, it would be a good idea to make this program readable only by root.

Source Code

Guy Baconniere, from Infomaniak Network SA, has written a couple of patches for plugh. One patch just modifies the code so that it will compile on Debian 3.1, and the other one is a somewhat more involved patch that moves command options around to be more compatable with the options provided to getty on Debian, plus uses login -f to log the user in instead of doing it by hand.

Credits

  1. The code that reads /etc/gettydefs is from mgetty 0.18 and the mgetty-README and mgetty-THANKS files are from that distribution to properly credit Gert Doering and all the other people who contributed to mgetty up through version 0.18

  2. The license plates on this page are courtesy R.T.’s Blank Plates and the Acme.com licensemaker.