1ttymon(1M) System Administration Commands ttymon(1M)
2
3
4
6 ttymon - port monitor for terminal ports
7
9 /usr/lib/saf/ttymon
10
11
12 /usr/lib/saf/ttymon -g [-d device] [-h] [-t timeout]
13 [-l ttylabel] [-p prompt] [-m modules] [-T termtype]
14
15
17 ttymon is a STREAMS-based TTY port monitor. Its function is to monitor
18 ports, to set terminal modes, baud rates, and line disciplines for the
19 ports, and to connect users or applications to services associated with
20 the ports. Normally, ttymon is configured to run under the Service
21 Access Controller, sac(1M), as part of the Service Access Facility
22 (SAF). It is configured using the sacadm(1M) command. Each instance of
23 ttymon can monitor multiple ports. The ports monitored by an instance
24 of ttymon are specified in the port monitor's administrative file. The
25 administrative file is configured using the pmadm(1M) and ttyadm(1M)
26 commands. When an instance of ttymon is invoked by the sac command, it
27 starts to monitor its ports. For each port, ttymon first initializes
28 the line disciplines, if they are specified, and the speed and terminal
29 settings. For ports with entries in /etc/logindevperm, device owner,
30 group and permissions are set. (See logindevperm(4).) The values used
31 for initialization are taken from the appropriate entry in the TTY set‐
32 tings file. This file is maintained by the sttydefs(1M) command.
33 Default line disciplines on ports are usually set up by the auto‐
34 push(1M) command of the Autopush Facility.
35
36
37 ttymon then writes the prompt and waits for user input. If the user
38 indicates that the speed is inappropriate by pressing the BREAK key,
39 ttymon tries the next speed and writes the prompt again. When valid
40 input is received, ttymon interprets the per-service configuration file
41 for the port, if one exists, creates a utmpx entry if required (see
42 utmpx(4)), establishes the service environment, and then invokes the
43 service associated with the port. Valid input consists of a string of
44 at least one non-newline character, terminated by a carriage return.
45 After the service terminates, ttymon cleans up the utmpx entry, if one
46 exists, and returns the port to its initial state.
47
48
49 If autobaud is enabled for a port, ttymon will try to determine the
50 baud rate on the port automatically. Users must enter a carriage return
51 before ttymon can recognize the baud rate and print the prompt. Cur‐
52 rently, the baud rates that can be determined by autobaud are 110,
53 1200, 2400, 4800, and 9600.
54
55
56 If a port is configured as a bidirectional port, ttymon will allow
57 users to connect to a service, and, if the port is free, will allow
58 uucico(1M), cu(1C), or ct(1C) to use it for dialing out. If a port is
59 bidirectional, ttymon will wait to read a character before it prints a
60 prompt.
61
62
63 If the connect-on-carrier flag is set for a port, ttymon will immedi‐
64 ately invoke the port's associated service when a connection request is
65 received. The prompt message will not be sent.
66
67
68 If a port is disabled, ttymon will not start any service on that port.
69 If a disabled message is specified, ttymon will send out the disabled
70 message when a connection request is received. If ttymon is disabled,
71 all ports under that instance of ttymon will also be disabled.
72
73 Service Invocation
74 The service ttymon invokes for a port is specified in the ttymon admin‐
75 istrative file. ttymon will scan the character string giving the ser‐
76 vice to be invoked for this port, looking for a %d or a %% two-charac‐
77 ter sequence. If %d is found, ttymon will modify the service command to
78 be executed by replacing those two characters by the full path name of
79 this port (the device name). If %% is found, they will be replaced by a
80 single %. When the service is invoked, file descriptor 0, 1, and 2 are
81 opened to the port device for reading and writing. The service is
82 invoked with the user ID, group ID and current home directory set to
83 that of the user name under which the service was registered with tty‐
84 mon. Two environment variables, HOME and TTYPROMPT, are added to the
85 service's environment by ttymon. HOME is set to the home directory of
86 the user name under which the service is invoked. TTYPROMPT is set to
87 the prompt string configured for the service on the port. This is pro‐
88 vided so that a service invoked by ttymon has a means of determining if
89 a prompt was actually issued by ttymon and, if so, what that prompt
90 actually was.
91
92
93 See ttyadm(1M) for options that can be set for ports monitored by tty‐
94 mon under the Service Access Controller.
95
96 System Console Invocation
97 The invocation of ttymon on the system console is managed under smf(5)
98 by the service svc:/system/console-login. It provides a number of prop‐
99 erties within the property group ttymon to control the invocation, as
100 follows:
101
102 NAME TYPE TTYMON OPTION
103 ----------------------------------------------------------
104 device astring [-d device]
105 nohangup boolean [-h]
106 label astring [-l label]
107 modules astring [-m module1,module2]
108 prompt astring [-p prompt]
109 timeout count [-t timeout]
110 terminal_type astring [-T termtype]
111
112
113
114
115 If any value is the empty string or an integer set to zero, then the
116 option is not passed to the ttymon invocation. The -g option is always
117 specified for this invocation. The -d option always defaults to
118 /dev/console if it is not set.
119
120
121 See EXAMPLES.
122
124 ttymon uses pam(3PAM) for session management. The PAM configuration
125 policy, listed through /etc/pam.conf, specifies the modules to be used
126 for ttymon. Here is a partial pam.conf file with entries for ttymon
127 using the UNIX session management module.
128
129 ttymon session required /usr/lib/security/pam_unix_session.so.1
130
131
132
133 If there are no entries for the ttymon service, then the entries for
134 the "other" service will be used.
135
137 The following options are supported:
138
139 -g A special invocation of ttymon is provided with the -g
140 option. This form of the command should only be called by
141 applications that need to set the correct baud rate and
142 terminal settings on a port and then connect to login
143 service, but that cannot be pre-configured under the SAC.
144 The following combinations of options can be used with
145 -g:
146
147
148 -ddevice device is the full path name of the port to which ttymon
149 is to attach. If this option is not specified, file
150 descriptor 0 must be set up by the invoking process to a
151 TTY port.
152
153
154 -h If the -h flag is not set, ttymon will force a hangup on
155 the line by setting the speed to zero before setting the
156 speed to the default or specified speed.
157
158
159 -lttylabel ttylabel is a link to a speed and TTY definition in the
160 ttydefs file. This definition tells ttymon at what speed
161 to run initially, what the initial TTY settings are, and
162 what speed to try next if the user indicates that the
163 speed is inappropriate by pressing the BREAK key. The
164 default speed is 9600 baud.
165
166
167 -mmodules When initializing the port, ttymon will pop all modules
168 on the port, and then push modules in the order speci‐
169 fied. modules is a comma-separated list of pushable mod‐
170 ules. Default modules on the ports are usually set up by
171 the Autopush Facility.
172
173
174 -pprompt Allows the user to specify a prompt string. The default
175 prompt is Login:.
176
177
178 -ttimeout Specifies that ttymon should exit if no one types any‐
179 thing in timeout seconds after the prompt is sent.
180
181
182 -Ttermtype Sets the TERM environment variable to termtype.
183
184
186 Example 1 Setting the Terminal Type
187
188
189 The following example sets the value of the terminal type (-T) option
190 for the system console ttymon invocation:
191
192
193 svccfg -s svc:/system/console-login setprop \
194 ttymon/terminal_type = "xterm"
195 svcadm refresh svc:/system/console-login:default
196
197
198
200 If any of the LC_* variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COL‐
201 LATE, LC_NUMERIC, and LC_MONETARY ) (see environ(5)) are not set in the
202 environment, the operational behavior of ttymon for each corresponding
203 locale category is determined by the value of the LANG environment
204 variable. If LC_ALL is set, its contents are used to override both the
205 LANG and the other LC_* variables. If none of the above variables is
206 set in the environment, the "C" (U.S. style) locale determines how tty‐
207 mon behaves.
208
209 LC_CTYPE Determines how ttymon handles characters. When LC_CTYPE is
210 set to a valid value, ttymon can display and handle text
211 and filenames containing valid characters for that locale.
212 ttymon can display and handle Extended Unix Code (EUC)
213 characters where any individual character can be 1, 2, or 3
214 bytes wide. ttymon can also handle EUC characters of 1, 2,
215 or more column widths. In the "C" locale, only characters
216 from ISO 8859-1 are valid.
217
218
220 /etc/logindevperm
221
222
224 See attributes(5) for descriptions of the following attributes:
225
226
227
228
229 ┌─────────────────────────────┬─────────────────────────────┐
230 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
231 ├─────────────────────────────┼─────────────────────────────┤
232 │Availability │SUNWcsu │
233 ├─────────────────────────────┼─────────────────────────────┤
234 │Stability │See below. │
235 └─────────────────────────────┴─────────────────────────────┘
236
237
238 The command-line syntax is Stable. The SMF properties are Evolving.
239
241 ct(1C), cu(1C), autopush(1M), pmadm(1M), sac(1M), sacadm(1M), stty‐
242 defs(1M), ttyadm(1M), uucico(1M), pam(3PAM), logindevperm(4),
243 pam.conf(4), utmpx(4), attributes(5), environ(5), pam_authtok_check(5),
244 pam_authtok_get(5), pam_authtok_store(5), pam_dhkeys(5),
245 pam_passwd_auth(5), pam_unix_account(5), pam_unix_auth(5),
246 pam_unix_session(5), smf(5)
247
248
249
250
252 If a port is monitored by more than one ttymon, it is possible for the
253 ttymons to send out prompt messages in such a way that they compete for
254 input.
255
256
257 The pam_unix(5) module is no longer supported. Similar functionality is
258 provided by pam_authtok_check(5), pam_authtok_get(5), pam_auth‐
259 tok_store(5), pam_dhkeys(5), pam_passwd_auth(5), pam_unix_account(5),
260 pam_unix_auth(5), and pam_unix_session(5).
261
262
263
264SunOS 5.11 22 Feb 2005 ttymon(1M)