1998-08-29 21:31:55 +04:00
|
|
|
.\" $NetBSD: ttyaction.5,v 1.3 1998/08/29 17:31:57 tsarna Exp $
|
1996-11-14 20:40:55 +03:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Gordon W. Ross.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
1997-10-09 01:59:52 +04:00
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
1996-11-14 20:40:55 +03:00
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.Dd August 24, 1996
|
|
|
|
.Dt TTYACTION 5
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm ttyaction
|
|
|
|
.Nd ttyaction file format
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm ttyaction
|
|
|
|
file specifies site-specific commands to run
|
|
|
|
when a login session begins and ends. The
|
|
|
|
.Nm ttyaction
|
|
|
|
file contains a list of newline separated records, where
|
|
|
|
each record has the following three fields:
|
|
|
|
.Bl -tag -width username
|
|
|
|
.It ttyname
|
|
|
|
Name of the tty line(s) on which this line should apply.
|
|
|
|
The name is relative to the
|
|
|
|
.Pa /dev
|
|
|
|
directory, similar to how such devices are named in the
|
|
|
|
.Pa /etc/ttys
|
|
|
|
file.
|
|
|
|
.It action
|
|
|
|
Name of the action for which this line should apply.
|
1998-08-29 21:31:55 +04:00
|
|
|
The action names currently defined are "login", "getty",
|
|
|
|
"telnetd" and "rlogind"
|
1996-11-14 20:40:55 +03:00
|
|
|
which indicate which program is processing this file.
|
1998-08-29 21:31:55 +04:00
|
|
|
(Note that "login" begins a login session, while the other
|
|
|
|
three are run after a login session ends.)
|
1996-11-14 20:40:55 +03:00
|
|
|
.It command
|
|
|
|
What command to run if this record matches.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The first two fields are delimited with blanks or tabs,
|
|
|
|
and the command field is all text to the end of the line.
|
|
|
|
Either or both of first two fields may contain wildcard
|
|
|
|
match patterns as implemented by the
|
|
|
|
.Fn fnmatch
|
|
|
|
library function.
|
|
|
|
.Pp
|
|
|
|
All command strings are executed by passing them to
|
|
|
|
.Pa /bin/sh \-c
|
|
|
|
running as "root," with an environment containing:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
TTY=ttyname
|
|
|
|
ACT=action
|
|
|
|
USER=username
|
|
|
|
PATH=_PATH_STDPATH
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
These variables may be used directly in the shell command
|
|
|
|
part of the record for simple tasks such as changing the
|
|
|
|
ownership of related devices. For example:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
console * chown ${USER}.tty /dev/mouse
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
will
|
|
|
|
.Fa chown
|
|
|
|
the mouse appropriately when the console owner changes.
|
|
|
|
.Sh EXAMPLE
|
|
|
|
Here are some more example records:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
tty0 login /somewhere/tty_setup ${TTY}
|
|
|
|
tty0 getty /somewhere/tty_clean ${TTY}
|
|
|
|
* * /somewhere/ttyfrob ${TTY} ${ACT}
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr fnmatch 3 ,
|
|
|
|
.Xr ttyaction 3
|
|
|
|
.Sh HISTORY
|
|
|
|
The ideas for the
|
|
|
|
.Pa /etc/ttyaction
|
|
|
|
file were inspired by the
|
|
|
|
.Pa /etc/fbtab
|
|
|
|
file under SunOS.
|