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 ;) |