xref: /dragonfly/libexec/getty/ttys.5 (revision 556932ec)
1.\" Copyright (c) 1985, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     from: @(#)ttys.5	8.1 (Berkeley) 6/4/93
29.\" $FreeBSD: head/libexec/getty/ttys.5 330277 2018-03-02 14:16:19Z trasz $
30.\"
31.Dd September 20, 2023
32.Dt TTYS 5
33.Os
34.Sh NAME
35.Nm ttys
36.Nd terminal initialization information
37.Sh DESCRIPTION
38The file
39.Nm
40contains information that is used by various routines to initialize
41and control the use of terminal special files.
42This information is read with the
43.Xr getttyent 3
44library routines.
45There is one line in the
46.Nm
47file per special device file.
48Fields are separated by tabs and/or spaces.
49Fields comprised of more than one word should be enclosed in
50double quotes
51.Pq \&" .
52Blank lines and comments may appear anywhere in the file;
53comments are delimited by hash marks
54.Pq #
55and new lines.
56Any unspecified fields will default to null.
57.Pp
58The first field is normally the
59name of the terminal special file as it is found in
60.Pa /dev .
61However, it can be any arbitrary string
62when the associated command is not related to a tty.
63.Pp
64The second field of the file is the command to execute for the line,
65usually
66.Xr getty 8 ,
67which initializes and opens the line, setting the speed, waiting for
68a user name and executing the
69.Xr login 1
70program.
71It can be, however, any desired command, for example
72the start up for a window system terminal emulator or some other
73daemon process, and can contain multiple words if quoted.
74.Pp
75The third field is the type of terminal usually connected to that
76tty line, normally the one found in the
77.Xr termcap 5
78data base file.
79The environment variable
80.Ev TERM
81is initialized with the value by
82either
83.Xr getty 8
84or
85.Xr login 1 .
86.Pp
87The remaining fields set flags in the
88.Fa ty_status
89entry (see
90.Xr getttyent 3 ) ,
91specify a window system process that
92.Xr init 8
93will maintain for the terminal line, optionally determine the
94type of tty (whether dialup, network or otherwise),
95or specify a tty group
96name that allows the login class database (see
97.Xr login.conf 5 )
98to refer to many ttys as a group, to selectively allow or
99deny access or enable or disable accounting facilities for
100ttys as a group.
101.Pp
102The following flag values are supported:
103.Bl -tag -width "ifconsole" -offset indent
104.It on
105Enable the tty entry so that
106.Xr init 8
107should execute the command given in the second field.
108.It off
109Disable the tty entry.
110.It ifconsole
111Disable the tty entry if it is not the console.
112That is, you can construct a tty entry with both this flag and the
113.Dq on
114flag to make it only active if that tty is the console.
115.It ifexists
116Disable the tty entry if it doesn't exist.
117.It secure
118If the
119.Dq on
120flag is specified, this flag allows users with a uid of 0
121to login on this line.
122.It dialup
123Indicate that the tty entry describes a dialup line.
124.It network
125Indicate that the tty entry provides a network connection.
126.El
127.Pp
128Either of these flag values may also be specified in the
129terminal type field.
130.Pp
131The string
132.Dq window=
133may be followed by a quoted command string which
134.Xr init 8
135will execute
136.Em before
137starting the command specified by the second field.
138.Pp
139The string
140.Dq group=
141may be followed by a group name comprised of
142alphanumeric characters that can be used by
143.Xr login.conf 5
144to refer to many tty lines as a group to enable or disable access
145and accounting facilities.
146If no group is specified, then the tty becomes a member of the group
147.Dq none .
148For backwards compatibility, the
149.Dq group=
150should appear last on the line, immediately before the optional comment.
151.Pp
152Both the second field and any command specified with
153.Dq window=
154will be split into words and executed using
155.Xr execve 2 .
156Words are separated by any combinations of tabs and spaces.
157Arguments containing whitespace should be enclosed in single quotes
158.Pq ' .
159Note that no shell-style globbing or other variable substitution occurs.
160.Sh FILES
161.Bl -tag -width /etc/ttys -compact
162.It Pa /etc/ttys
163.El
164.Sh EXAMPLES
165.Bd -literal
166# root login on console at 1200 baud
167console	"/usr/libexec/getty std.1200"	vt100	on secure
168# dialup at 1200 baud, no root logins
169ttyd0	"/usr/libexec/getty d1200"	dialup	on group=dialup	# 555-1234
170# dialup at 115200 baud, enable only if it's the console
171ttyd1	"/usr/libexec/getty std.115200"	dialup	on secure ifconsole
172# Mike's terminal: hp2621
173ttyh0	"/usr/libexec/getty std.115200"	hp2621-nl	on group=dialup	# 457 Evans
174# John's terminal: vt100
175ttyh1	"/usr/libexec/getty std.115200"	vt100	on group=dialup		# 459 Evans
176# terminal emulate/window system
177ttyv0	"/usr/local/bin/xterm -display :0"	xterm	on window="/usr/local/bin/X :0"
178# enable the video tty only if it exists
179ttyv1	"/usr/libexec/getty Pc"		cons25	on secure ifexists
180# Network pseudo ttys -- don't enable getty
181ttyp0	none	network 	group=pty
182ttyp1	none	network	off	group=pty
183.Ed
184.Sh SEE ALSO
185.Xr login 1 ,
186.Xr getttyent 3 ,
187.Xr gettytab 5 ,
188.Xr login.conf 5 ,
189.Xr termcap 5 ,
190.Xr getty 8 ,
191.Xr init 8 ,
192.Xr pstat 8
193.\".Xr ttyflags 8
194.Sh HISTORY
195A
196.Nm
197file appeared in
198.At v6 .
199