xref: /netbsd-src/lib/libutil/ttyaction.3 (revision f96996de73923c47404ad0d08162b451791959de)
1*f96996deSmrg.\" $NetBSD: ttyaction.3,v 1.16 2021/03/21 23:29:36 mrg Exp $
26ab34f58Sgwr.\"
36ab34f58Sgwr.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
46ab34f58Sgwr.\" All rights reserved.
56ab34f58Sgwr.\"
66ab34f58Sgwr.\" This code is derived from software contributed to The NetBSD Foundation
76ab34f58Sgwr.\" by Gordon W. Ross.
86ab34f58Sgwr.\"
96ab34f58Sgwr.\" Redistribution and use in source and binary forms, with or without
106ab34f58Sgwr.\" modification, are permitted provided that the following conditions
116ab34f58Sgwr.\" are met:
126ab34f58Sgwr.\" 1. Redistributions of source code must retain the above copyright
136ab34f58Sgwr.\"    notice, this list of conditions and the following disclaimer.
146ab34f58Sgwr.\" 2. Redistributions in binary form must reproduce the above copyright
156ab34f58Sgwr.\"    notice, this list of conditions and the following disclaimer in the
166ab34f58Sgwr.\"    documentation and/or other materials provided with the distribution.
176ab34f58Sgwr.\"
186ab34f58Sgwr.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
196ab34f58Sgwr.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
206ab34f58Sgwr.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2123bee85aSjtc.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2223bee85aSjtc.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
236ab34f58Sgwr.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
246ab34f58Sgwr.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
256ab34f58Sgwr.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
266ab34f58Sgwr.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
276ab34f58Sgwr.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
286ab34f58Sgwr.\" POSSIBILITY OF SUCH DAMAGE.
296ab34f58Sgwr.\"
3045b87028Sjruoho.Dd May 4, 2010
316ab34f58Sgwr.Dt TTYACTION 3
326ab34f58Sgwr.Os
336ab34f58Sgwr.Sh NAME
346ab34f58Sgwr.Nm ttyaction
356ab34f58Sgwr.Nd ttyaction utility function
36312aca53Sperry.Sh LIBRARY
37312aca53Sperry.Lb libutil
386ab34f58Sgwr.Sh SYNOPSIS
39472351e1Swiz.In util.h
40c75f1026Smikel.Ft int
416ab34f58Sgwr.Fn ttyaction "char *ttyname" "char *action" "char *username"
426ab34f58Sgwr.Sh DESCRIPTION
436ab34f58SgwrThe
446ab34f58Sgwr.Fn ttyaction
456ab34f58Sgwrfunction is used by
46c89a574fStsarna.Xr login 1 ,
47c89a574fStsarna.Xr getty 8 ,
48c89a574fStsarna.Xr telnetd 8
496ab34f58Sgwrand
50c89a574fStsarna.Xr rlogind 8
516ab34f58Sgwrto execute site-specific commands
526ab34f58Sgwrwhen a login session begins and ends.
536ab34f58Sgwr.Pp
546ab34f58SgwrThe
556ab34f58Sgwr.Fn ttyaction
566ab34f58Sgwrfunction scans the
576ab34f58Sgwr.Pa /etc/ttyaction
586ab34f58Sgwrfile for any records that match the current
596ab34f58Sgwr.Fa ttyname
606ab34f58Sgwrand
616ab34f58Sgwr.Fa action
6227adb020Swizparameters, and for each matching record,
6327adb020Swizruns the shell command shown in that record.
6427adb020SwizThe record format is described in
656ab34f58Sgwr.Xr ttyaction 5 .
666ab34f58SgwrThe parameter
676ab34f58Sgwr.Fa username
686ab34f58Sgwris the name of the new owner of the
696ab34f58Sgwr.Fa ttyname
7027adb020Swizdevice.
7127adb020SwizNote that the
729d693450Sgwr.Fa ttyname
739d693450Sgwrparameter may be passed as a fully qualified pathname, and the
749d693450Sgwr.Fn ttyaction
759d693450Sgwrfunction will skip the leading "/dev/" part of the string.
7601d37782Slukem(This is a convenience for login and getty.)
776ab34f58Sgwr.Sh RETURN VALUES
786ab34f58Sgwr.Fn ttyaction
796ab34f58Sgwrreturns the status of the last command it executed,
806ab34f58Sgwror zero if no matching commands were found.
816ab34f58Sgwr.Sh FILES
826ab34f58Sgwr.Bl -tag -width /etc/ttyaction -compact
836ab34f58Sgwr.It Pa /dev/\(**
8444fa9426Sfvdl.It Pa /etc/ttyaction
856ab34f58Sgwr.El
866ab34f58Sgwr.Sh SEE ALSO
876ab34f58Sgwr.Xr ttyaction 5
88*f96996deSmrg.Sh HISTORY
89*f96996deSmrgThe
90*f96996deSmrg.Fn ttyaction
91*f96996deSmrgfunction appeared in
92*f96996deSmrg.Nx 1.3 .
936ab34f58Sgwr.Sh AUTHORS
94104b35feSgrant.An Gordon W. Ross
95104b35feSgrant.Aq gwr@NetBSD.org ,
96104b35feSgrant.An Chris G. Demetriou
97104b35feSgrant.Aq cgd@NetBSD.org ,
98104b35feSgrant.An Ty Sarna
998c31ceecStsarna.Aq tsarna@NetBSD.org .
1006ab34f58Sgwr.Sh BUGS
1016ab34f58SgwrThere should be some
1026ab34f58Sgwr.Em other
1036ab34f58Sgwrmechanism to allow selection of different access control policies
10427adb020Swizon a per-line basis.
10527adb020SwizIt has been suggested that the same
10645b87028Sjruoho.Fn ttyaction
1076ab34f58Sgwrmechanism should also be used for determining access control, but
1086ab34f58Sgwrit was decided (after much discussion) that
10945b87028Sjruoho.Fn ttyaction
1106ab34f58Sgwrshould only describe actions to be performed
1116ab34f58Sgwr.Em after
1126ab34f58Sgwrthe system has decided to change the ownership of some tty.
1136ab34f58SgwrAccess control policies will be handled by a separate mechanism.
114