I'm not sure what /etc/inittab has in it, but it's probably the same as /etc/ttys on my OpenBSD boxes.

Here's the kluge I've been able to make work so far. In essence, I wrote a shell script, run as root (as that portion of the login must), and listed it in my gettytab as the program to run after getting a login name for a particular terminal type. Then I played with the /etc/shells file and the user's password file entry to get the perl program run as that user's shell.

In more detail, my gettytab file uses the 'lo' prefix to identify the program to be run after receiving a username:

from /etc/gettytab
yrdterm:\
        :np:sp#9600:lo=/root/login:lm=Login? :

That program (/root/login) does a forced login for a given user. (login -f user can only be run as root.)

from /root/login
#!/bin/sh
/usr/bin/login -f yrd

When the terminal gets set up (under init), it refers to /etc/ttys. This is probably the same as (or similar to) Linux's inittab.

from /etc/ttys
ttyC5   "/usr/libexec/getty yrdterm"        vt220   on

(BTW, that's on console 5, not on the serial port, for simplicity in testing. I want to deal configuration of the server and configuration of the serial link separately ;)

When /root/login drops the terminal to the user yrd's login, I want it to run the perl script as the shell. So i set the user's shell to the perl script, and added it to /etc/shells.

from /etc/passwd
yrd:*:1001:1001:yrd:/home/yrd:/home/yrd/weld

Ultimately, I think this is an inelegant, convoluted, almost unacceptable solution :) I really should be able to run one program from /etc/ttys that changes UID to the appropriate user and runs the program. I just don't know how yet ;)


In reply to Re: Re: Replacing getty with a perl script? by ginseng
in thread Replacing getty with a perl script? by ginseng

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.