xref: /netbsd-src/share/man/man5/ttyaction.5 (revision 4df5d7619bd0edd9b1d94b972365dcfe183e8e15)
1*4df5d761Swiz.\" $NetBSD: ttyaction.5,v 1.11 2021/03/22 00:09:06 wiz Exp $
2a1cdc82aSgwr.\"
3a1cdc82aSgwr.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
4a1cdc82aSgwr.\" All rights reserved.
5a1cdc82aSgwr.\"
6a1cdc82aSgwr.\" This code is derived from software contributed to The NetBSD Foundation
7a1cdc82aSgwr.\" by Gordon W. Ross.
8a1cdc82aSgwr.\"
9a1cdc82aSgwr.\" Redistribution and use in source and binary forms, with or without
10a1cdc82aSgwr.\" modification, are permitted provided that the following conditions
11a1cdc82aSgwr.\" are met:
12a1cdc82aSgwr.\" 1. Redistributions of source code must retain the above copyright
13a1cdc82aSgwr.\"    notice, this list of conditions and the following disclaimer.
14a1cdc82aSgwr.\" 2. Redistributions in binary form must reproduce the above copyright
15a1cdc82aSgwr.\"    notice, this list of conditions and the following disclaimer in the
16a1cdc82aSgwr.\"    documentation and/or other materials provided with the distribution.
17a1cdc82aSgwr.\"
18a1cdc82aSgwr.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19a1cdc82aSgwr.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20a1cdc82aSgwr.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21516fb1f3Sjtc.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22516fb1f3Sjtc.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23a1cdc82aSgwr.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24a1cdc82aSgwr.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25a1cdc82aSgwr.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26a1cdc82aSgwr.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27a1cdc82aSgwr.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28a1cdc82aSgwr.\" POSSIBILITY OF SUCH DAMAGE.
29a1cdc82aSgwr.\"
30a1cdc82aSgwr.Dd August 24, 1996
31a1cdc82aSgwr.Dt TTYACTION 5
32a1cdc82aSgwr.Os
33a1cdc82aSgwr.Sh NAME
34a1cdc82aSgwr.Nm ttyaction
35a1cdc82aSgwr.Nd ttyaction file format
36a1cdc82aSgwr.Sh DESCRIPTION
37a1cdc82aSgwrThe
38a1cdc82aSgwr.Nm ttyaction
39a1cdc82aSgwrfile specifies site-specific commands to run
40*4df5d761Swizwhen a login session begins and ends.
41*4df5d761SwizThe
42a1cdc82aSgwr.Nm ttyaction
43a1cdc82aSgwrfile contains a list of newline separated records, where
44a1cdc82aSgwreach record has the following three fields:
45a1cdc82aSgwr.Bl -tag -width username
46a1cdc82aSgwr.It ttyname
47a1cdc82aSgwrName of the tty line(s) on which this line should apply.
48a1cdc82aSgwrThe name is relative to the
49a1cdc82aSgwr.Pa /dev
50a1cdc82aSgwrdirectory, similar to how such devices are named in the
51a1cdc82aSgwr.Pa /etc/ttys
52a1cdc82aSgwrfile.
53a1cdc82aSgwr.It action
54a1cdc82aSgwrName of the action for which this line should apply.
55c89a574fStsarnaThe action names currently defined are "login", "getty",
56c89a574fStsarna"telnetd" and "rlogind"
57a1cdc82aSgwrwhich indicate which program is processing this file.
58c89a574fStsarna(Note that "login" begins a login session, while the other
59c89a574fStsarnathree are run after a login session ends.)
60a1cdc82aSgwr.It command
61a1cdc82aSgwrWhat command to run if this record matches.
62a1cdc82aSgwr.El
63a1cdc82aSgwr.Pp
64a1cdc82aSgwrThe first two fields are delimited with blanks or tabs,
65a1cdc82aSgwrand the command field is all text to the end of the line.
66a1cdc82aSgwrEither or both of first two fields may contain wildcard
67a1cdc82aSgwrmatch patterns as implemented by the
689cd4c38bSabhinav.Xr fnmatch 3
69a1cdc82aSgwrlibrary function.
70a1cdc82aSgwr.Pp
71a1cdc82aSgwrAll command strings are executed by passing them to
72a1cdc82aSgwr.Pa /bin/sh \-c
73a1cdc82aSgwrrunning as "root," with an environment containing:
74a1cdc82aSgwr.Bd -literal -offset indent
75a1cdc82aSgwrTTY=ttyname
76a1cdc82aSgwrACT=action
77a1cdc82aSgwrUSER=username
78a1cdc82aSgwrPATH=_PATH_STDPATH
79a1cdc82aSgwr.Ed
80a1cdc82aSgwr.Pp
81a1cdc82aSgwrThese variables may be used directly in the shell command
82a1cdc82aSgwrpart of the record for simple tasks such as changing the
83*4df5d761Swizownership of related devices.
84*4df5d761SwizFor example:
85a1cdc82aSgwr.Bd -literal -offset indent
86ee1ff165Skleinkconsole  *	chown ${USER}:tty /dev/mouse
87a1cdc82aSgwr.Ed
88a1cdc82aSgwr.Pp
89a1cdc82aSgwrwill
90a1cdc82aSgwr.Fa chown
91a1cdc82aSgwrthe mouse appropriately when the console owner changes.
921f8c01efSwiz.Sh EXAMPLES
93a1cdc82aSgwrHere are some more example records:
94a1cdc82aSgwr.Bd -literal -offset indent
95a1cdc82aSgwrtty0	login	/somewhere/tty_setup ${TTY}
96a1cdc82aSgwrtty0	getty	/somewhere/tty_clean ${TTY}
97a1cdc82aSgwr*	*	/somewhere/ttyfrob ${TTY} ${ACT}
98a1cdc82aSgwr.Ed
99a1cdc82aSgwr.Sh SEE ALSO
100a1cdc82aSgwr.Xr fnmatch 3 ,
101a1cdc82aSgwr.Xr ttyaction 3
102a1cdc82aSgwr.Sh HISTORY
103f96996deSmrgSupport for the
104f96996deSmrg.Pa /etc/ttyaction
105f96996deSmrgfile first appeared in
106f96996deSmrg.Nx 1.3 .
107a1cdc82aSgwrThe ideas for the
108a1cdc82aSgwr.Pa /etc/ttyaction
109a1cdc82aSgwrfile were inspired by the
110a1cdc82aSgwr.Pa /etc/fbtab
111a1cdc82aSgwrfile under SunOS.
112