xref: /minix3/lib/libutil/ttyaction.3 (revision 0c3983b25a88161cf074524e5c94585a2582ae82)
1*0c3983b2SBen Gras.\" $NetBSD: ttyaction.3,v 1.15 2010/05/04 06:41:27 jruoho Exp $
2*0c3983b2SBen Gras.\"
3*0c3983b2SBen Gras.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
4*0c3983b2SBen Gras.\" All rights reserved.
5*0c3983b2SBen Gras.\"
6*0c3983b2SBen Gras.\" This code is derived from software contributed to The NetBSD Foundation
7*0c3983b2SBen Gras.\" by Gordon W. Ross.
8*0c3983b2SBen Gras.\"
9*0c3983b2SBen Gras.\" Redistribution and use in source and binary forms, with or without
10*0c3983b2SBen Gras.\" modification, are permitted provided that the following conditions
11*0c3983b2SBen Gras.\" are met:
12*0c3983b2SBen Gras.\" 1. Redistributions of source code must retain the above copyright
13*0c3983b2SBen Gras.\"    notice, this list of conditions and the following disclaimer.
14*0c3983b2SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
15*0c3983b2SBen Gras.\"    notice, this list of conditions and the following disclaimer in the
16*0c3983b2SBen Gras.\"    documentation and/or other materials provided with the distribution.
17*0c3983b2SBen Gras.\"
18*0c3983b2SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19*0c3983b2SBen Gras.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20*0c3983b2SBen Gras.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21*0c3983b2SBen Gras.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22*0c3983b2SBen Gras.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*0c3983b2SBen Gras.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*0c3983b2SBen Gras.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*0c3983b2SBen Gras.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*0c3983b2SBen Gras.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*0c3983b2SBen Gras.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*0c3983b2SBen Gras.\" POSSIBILITY OF SUCH DAMAGE.
29*0c3983b2SBen Gras.\"
30*0c3983b2SBen Gras.Dd May 4, 2010
31*0c3983b2SBen Gras.Dt TTYACTION 3
32*0c3983b2SBen Gras.Os
33*0c3983b2SBen Gras.Sh NAME
34*0c3983b2SBen Gras.Nm ttyaction
35*0c3983b2SBen Gras.Nd ttyaction utility function
36*0c3983b2SBen Gras.Sh LIBRARY
37*0c3983b2SBen Gras.Lb libutil
38*0c3983b2SBen Gras.Sh SYNOPSIS
39*0c3983b2SBen Gras.In util.h
40*0c3983b2SBen Gras.Ft int
41*0c3983b2SBen Gras.Fn ttyaction "char *ttyname" "char *action" "char *username"
42*0c3983b2SBen Gras.Sh DESCRIPTION
43*0c3983b2SBen GrasThe
44*0c3983b2SBen Gras.Fn ttyaction
45*0c3983b2SBen Grasfunction is used by
46*0c3983b2SBen Gras.Xr login 1 ,
47*0c3983b2SBen Gras.Xr getty 8 ,
48*0c3983b2SBen Gras.Xr telnetd 8
49*0c3983b2SBen Grasand
50*0c3983b2SBen Gras.Xr rlogind 8
51*0c3983b2SBen Grasto execute site-specific commands
52*0c3983b2SBen Graswhen a login session begins and ends.
53*0c3983b2SBen Gras.Pp
54*0c3983b2SBen GrasThe
55*0c3983b2SBen Gras.Fn ttyaction
56*0c3983b2SBen Grasfunction scans the
57*0c3983b2SBen Gras.Pa /etc/ttyaction
58*0c3983b2SBen Grasfile for any records that match the current
59*0c3983b2SBen Gras.Fa ttyname
60*0c3983b2SBen Grasand
61*0c3983b2SBen Gras.Fa action
62*0c3983b2SBen Grasparameters, and for each matching record,
63*0c3983b2SBen Grasruns the shell command shown in that record.
64*0c3983b2SBen GrasThe record format is described in
65*0c3983b2SBen Gras.Xr ttyaction 5 .
66*0c3983b2SBen GrasThe parameter
67*0c3983b2SBen Gras.Fa username
68*0c3983b2SBen Grasis the name of the new owner of the
69*0c3983b2SBen Gras.Fa ttyname
70*0c3983b2SBen Grasdevice.
71*0c3983b2SBen GrasNote that the
72*0c3983b2SBen Gras.Fa ttyname
73*0c3983b2SBen Grasparameter may be passed as a fully qualified pathname, and the
74*0c3983b2SBen Gras.Fn ttyaction
75*0c3983b2SBen Grasfunction will skip the leading "/dev/" part of the string.
76*0c3983b2SBen Gras(This is a convenience for login and getty.)
77*0c3983b2SBen Gras.Sh RETURN VALUES
78*0c3983b2SBen Gras.Fn ttyaction
79*0c3983b2SBen Grasreturns the status of the last command it executed,
80*0c3983b2SBen Grasor zero if no matching commands were found.
81*0c3983b2SBen Gras.Sh FILES
82*0c3983b2SBen Gras.Bl -tag -width /etc/ttyaction -compact
83*0c3983b2SBen Gras.It Pa /dev/\(**
84*0c3983b2SBen Gras.It Pa /etc/ttyaction
85*0c3983b2SBen Gras.El
86*0c3983b2SBen Gras.Sh SEE ALSO
87*0c3983b2SBen Gras.Xr ttyaction 5
88*0c3983b2SBen Gras.Sh AUTHORS
89*0c3983b2SBen Gras.An Gordon W. Ross
90*0c3983b2SBen Gras.Aq gwr@NetBSD.org ,
91*0c3983b2SBen Gras.An Chris G. Demetriou
92*0c3983b2SBen Gras.Aq cgd@NetBSD.org ,
93*0c3983b2SBen Gras.An Ty Sarna
94*0c3983b2SBen Gras.Aq tsarna@NetBSD.org .
95*0c3983b2SBen Gras.Sh BUGS
96*0c3983b2SBen GrasThere should be some
97*0c3983b2SBen Gras.Em other
98*0c3983b2SBen Grasmechanism to allow selection of different access control policies
99*0c3983b2SBen Grason a per-line basis.
100*0c3983b2SBen GrasIt has been suggested that the same
101*0c3983b2SBen Gras.Fn ttyaction
102*0c3983b2SBen Grasmechanism should also be used for determining access control, but
103*0c3983b2SBen Grasit was decided (after much discussion) that
104*0c3983b2SBen Gras.Fn ttyaction
105*0c3983b2SBen Grasshould only describe actions to be performed
106*0c3983b2SBen Gras.Em after
107*0c3983b2SBen Grasthe system has decided to change the ownership of some tty.
108*0c3983b2SBen GrasAccess control policies will be handled by a separate mechanism.
109