Spawning a login on a pty

Heimir Sverrisson heimir at hafro.is
Wed Aug 1 10:45:28 AEST 1990


I've been trying to start up a login process on the slave side
of a pty from an application that controls the master side.
I need this for an application that must take the user through
the getty->login->sh phase.

My approach was simply to fork-exec a '/etc/getty /dev/ttypX'
and talk to the '/dev/ptypX' device.  This was fine until the
'sh' was about to be started -- then I got this strange message
of 'no utmp entry' and to 'exec from the login shell'.  

I did try to double-fork to make the /etc/getty an orphan, then
I made it a process group leader (using setpgrp(2)) -- still w.o.
any luck.

At last I got the damn thing to work by writing a 'fake' utmp
entry to /etc/utmp using pututline(3). Then the problem is to keep
the utmp-entry up to date, i.e. when the user logs out of the pty.

My question to the net is:  Is this the way to go?  How do window-
managers, telnetd and rlogind do this?  How portable is it, will it
work in BSD environment, POSIX, AIX, MACH ?

I'll summarize if I get any usable answers.
--
Heimir Thor Sverrisson		heimir at hafro.is
-- 
---
Heimir Thor Sverrisson			Uucp: mcsun!isgate!hafro!heimir 
					Internet: heimir at hafro.is



More information about the Comp.unix.i386 mailing list