From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  7-JAN-1991 19:18:33.51
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	LOGINTERM - automatically start an interactive job

Received:  by crdgw1.ge.com (5.57/GE 1.80)
	 id AA11593; Mon, 7 Jan 91 18:59:45 EST
Message-Id:  <9101072359.AA11593@crdgw1.ge.com>
Received: From CUNYVM.CUNY.EDU by CRVAX.SRI.COM with TCP; Mon,  7 JAN 91 13:14:31 PST
Received: from DGOGWDG1.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.2.2MX) with BSMTP id 6310; Mon, 07 Jan 91 15:57:51 EST
Received: from dnet.gwdg.de by DGOGWDG1.BITNET (Mailer R2.07) with BSMTP id
 9806; Mon, 07 Jan 91 21:58:12 MEZ
Date:    Mon, 07 Jan 1991 21:58:09 +0100
From: "GWDGV1::MOELLER" <moeller%gwdgv1.dnet.gwdg.de@CUNYVM.CUNY.EDU>
To: info-vax@sri.com
Subject: LOGINTERM - automatically start an interactive job

Relates-to-subject: "Automatically starting a process at boot time"

I wrote:
>You can "log in" a terminal completely automatically by using
>SYS$CREPRC with NOPASSWORD and INTERACTIVE as the "flags" argument -
>that's how e.g. DECWINDOWS terminals get created "logged in".
>
>As far as I can see, these options are not available from RUN/DETACH,
>so a little program is required, available upon request.

Due to popular demand, the (small, trivial) program LOGINTERM follows below.
I have been using it for local terminals and OPA0; it also works for
dedicated LAT terminals (with Access=Remote set in the server).

My usage so far has been to log in rather privileged users,
so the program itself requires DETACH privilege;
access rights to the terminal involved will always be required.
I'm not sure if run/detached (i.e. the PRC$M_DETACH flag)
would work - this way you might not require DETACH privilege.

Access to a terminal normally requires SYSPRV,
unless SET PROTECTION/DEVICE has been used.

Warning: prior to invocation of LOGINTERM, make sure that the user is not
  already logged in. Otherwise LOGINTERM *will* work and login the user
  a second time on the same terminal, with rather strange terminal behaviour.

Hint: the user's LOGIN.COM can find out that it has been autologged this way -
      see F$GETJPI(...,"Creprc_Flags"). I haven't used it, though.

------ excerpt from SYSTARTUP_V5.COM (or even non-_V5) --------------
$ set prot=(O=rwlp,S=rwlp)/device/owner=OPERATOR CONSOL:
...
$ submit/user=OPERATOR STARTOPER.BAT !the user mentioned here will be logged in
$!				     !no other way to specify user name (!)
------------------------------------------------------
------ STARTOPER.BAT goes like ... -------------------
$ wait 0:0:30	! must be enough to have logins enabled by then
$!		! if CONSOL: is OPA0:, wait long enough for SYSTARTUP to finish!
$!
$ allocate CONSOL:		! test if in use
$ if .not.$status then exit	! don't want to login if already in use
$ deallocate CONSOL:
$!
$ set process/priv=DETACH
$ mcr SYS$LOGIN:LOGINTERM  CONSOL:	! ... or wherever this program resides
--------------------------------------------------------------------
--- LOGINTERM.MAR (the program you've been asking for) -------------
	.title	loginterm	create an interactive process w/o user prompt
;				with same username as caller.
;
;	w.j.m. 15-oct-1987 (VMS V4.5)
;
;	privileges required:
;	- DETACH required by caller
;	- access to terminal by uaf default privilege
;
	$prcdef
	$dvidef
;
image:		.ascid	"SYS$SYSTEM:LOGINOUT.EXE"
input_b:	.blkb	32
input:		.long	32,input_b
inputprompt:	.ascid	"Terminal: "
devnam_b:	.blkb	32
devnam:		.long	32,devnam_b
priv:		.long	-1,-1
;
dvicode2:	.long	dvi$_devnam
;
;*****
;
.entry	begin,^m<>
;
	pushaw	input				;ask for terminal name
	pushaq	inputprompt
	pushaq	input
	calls	#3,g^lib$get_foreign
	blbs	r0,11$
	ret
11$:
	pushaw	devnam				;better use physical device name
	pushaq	devnam
	clrl	-(sp)
	pushaq	input
	clrl	-(sp)
	pushal	dvicode2
	calls	#6,g^lib$getdvi
	blbs	r0,12$
	ret
12$:
	$creprc_s	-			;do the real work
		image=image,-
		input=devnam,-
		output=devnam,-
		error=devnam,-
		prvadr=priv,-
		prcnam=input,-
		baspri=#4,-
		uic=#^x00010004,-
		stsflg=#<prc$m_nopassword!prc$m_inter>
	ret
;
	.end	begin
--- end of LOGINTERM.MAR ----------------------------

Enjoy,

Wolfgang J. Moeller, GWDG, D-3400 Goettingen, F.R.Germany | Disclaimer ...
Bitnet/Earn: U0012@DGOGWDG5         Phone: +49 551 201516 | No claim intended!
Internet: Moeller@gwdgv1.dnet.gwdg.de   | This space intentionally left blank.

