1MESG(1P)                   POSIX Programmer's Manual                  MESG(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       mesg — permit or deny messages
13

SYNOPSIS

15       mesg [y|n]
16

DESCRIPTION

18       The mesg utility shall control whether other users are allowed to  send
19       messages  via write, talk, or other utilities to a terminal device. The
20       terminal device affected shall be determined by searching for the first
21       terminal  in  the  sequence  of devices associated with standard input,
22       standard output, and standard error, respectively. With  no  arguments,
23       mesg shall report the current state without changing it. Processes with
24       appropriate privileges may be able to send  messages  to  the  terminal
25       independent of the current state.
26

OPTIONS

28       None.
29

OPERANDS

31       The following operands shall be supported in the POSIX locale:
32
33       y         Grant  permission to other users to send messages to the ter‐
34                 minal device.
35
36       n         Deny permission to other users to send messages to the termi‐
37                 nal device.
38

STDIN

40       Not used.
41

INPUT FILES

43       None.
44

ENVIRONMENT VARIABLES

46       The following environment variables shall affect the execution of mesg:
47
48       LANG      Provide  a  default  value for the internationalization vari‐
49                 ables that are unset or null. (See the Base Definitions  vol‐
50                 ume  of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
51                 ables for the precedence  of  internationalization  variables
52                 used to determine the values of locale categories.)
53
54       LC_ALL    If  set  to  a non-empty string value, override the values of
55                 all the other internationalization variables.
56
57       LC_CTYPE  Determine the locale for the interpretation of  sequences  of
58                 bytes of text data as characters (for example, single-byte as
59                 opposed to multi-byte characters in arguments).
60
61       LC_MESSAGES
62                 Determine the locale that should be used to affect the format
63                 and  contents  of  diagnostic  messages  written (by mesg) to
64                 standard error.
65
66       NLSPATH   Determine the location of message catalogs for the processing
67                 of LC_MESSAGES.
68

ASYNCHRONOUS EVENTS

70       Default.
71

STDOUT

73       If  no  operand  is  specified, mesg shall display the current terminal
74       state in an unspecified format.
75

STDERR

77       The standard error shall be used only for diagnostic messages.
78

OUTPUT FILES

80       None.
81

EXTENDED DESCRIPTION

83       None.
84

EXIT STATUS

86       The following exit values shall be returned:
87
88        0    Receiving messages is allowed.
89
90        1    Receiving messages is not allowed.
91
92       >1    An error occurred.
93

CONSEQUENCES OF ERRORS

95       Default.
96
97       The following sections are informative.
98

APPLICATION USAGE

100       The mechanism by which the message status of the terminal is changed is
101       unspecified. Therefore, unspecified actions may cause the status of the
102       terminal to change after mesg has successfully completed. These actions
103       may  include,  but  are  not limited to: another invocation of the mesg
104       utility, login procedures; invocation of the stty  utility,  invocation
105       of the chmod utility or chmod() function, and so on.
106

EXAMPLES

108       None.
109

RATIONALE

111       The  terminal  changed  by  mesg  is  that associated with the standard
112       input, output, or error, rather than the controlling terminal  for  the
113       session.  This is because users logged in more than once should be able
114       to change any of their login terminals without having to stop  the  job
115       running  in  those  sessions.  This is not a security problem involving
116       the terminals of other users because appropriate  privileges  would  be
117       required to affect the terminal of another user.
118
119       The  method  of  checking  each  of the first three file descriptors in
120       sequence until a terminal is found was adopted from System V.
121
122       The file /dev/tty is not specified for the terminal device  because  it
123       was  thought to be too restrictive. Typical environment changes for the
124       n operand are that write permissions are removed for others  and  group
125       from  the  appropriate  device.  It  was  decided  to  leave the actual
126       description of what is done as unspecified because of potential differ‐
127       ences between implementations.
128
129       The  format  for  standard output is unspecified because of differences
130       between historical implementations. This output is generally not useful
131       to  shell  scripts  (they can use the exit status), so exact parsing of
132       the output is unnecessary.
133

FUTURE DIRECTIONS

135       None.
136

SEE ALSO

138       talk, write
139
140       The Base Definitions volume of  POSIX.1‐2017,  Chapter  8,  Environment
141       Variables
142
144       Portions  of  this text are reprinted and reproduced in electronic form
145       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
146       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
147       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
148       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
149       event of any discrepancy between this version and the original IEEE and
150       The  Open Group Standard, the original IEEE and The Open Group Standard
151       is the referee document. The original Standard can be  obtained  online
152       at http://www.opengroup.org/unix/online.html .
153
154       Any  typographical  or  formatting  errors that appear in this page are
155       most likely to have been introduced during the conversion of the source
156       files  to  man page format. To report such errors, see https://www.ker
157       nel.org/doc/man-pages/reporting_bugs.html .
158
159
160
161IEEE/The Open Group                  2017                             MESG(1P)
Impressum