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