By default, all the Linux systems accept standard input from another user connected in the same network using the wall or write commands.
It is possible due to the terminal’s ability to write messages received from another user on the screen; check out our article on Stdin, Stdout, and Stderr Streams in Linux, including what TTY is, to learn more.
The ability to receive messages from another network user and write them to your terminal can be enabled or disabled using the mesg command.
In this quick tutorial, you will learn how to check all the users and specific user terminal write access and how to set or stop the terminal’s permission for writing messages.
|Description||Check or set a terminal’s ability to receive messages from other users.|
|Root or Sudo Privileges||No|
|Host System and Architecture||Ubuntu 22.10 (x64)|
|OS Compatibility||Ubuntu, Manjaro, Fedora, etc.|
|Discussed Tools in this Article|
Usage of the Mesg Command
The mesg command takes two arguments: one will be the option, and the other will be “y” or “n” (all are optional).
$ mesg [OPTION] [y | n]
The following are known options offered by this command:
|Explain what is being done in more detail.|
|Display the help section.|
|Display the version information.|
Now let’s see how you can check your terminal’s write access or how you can allow or disallow receiving messages sent by someone on the network.
Check Your Terminal’s Write Access
By default, the permission to write messages on the terminal is enabled in all Linux distributions, and you can check your status by executing the following command:
The above output indicates that the permission to write messages on my terminal screen is enabled. If you get “is n” in the output, it means the permission is disabled.
Check Terminal Write Access for Other Users
The previous method only tells you your own terminal write permission; however, using a utility like “who” can assist you in checking the terminal write access of other users on the same network.
For example, the following command with the “
-T” flag will print the terminal status next to each user account name that is active on the same network.
$ who -T
The following is the list of all the possible permissions:
+” – The terminal is writable.
-” – The terminal is not writable.
?” – Bad line encountered.
Removing Terminal Write Access
If you have the writable permission on your terminal and want to deny any messages from other users (mostly it will be the sysadmin), then you can execute the following command.
$ mesg n -v
Once you deny write access to your terminal, any user in your local network attempting to send you messages via the wall or write command will be unsuccessful.
#Sending the messages using the wall command to the denied user
As you can see from the above picture, the “david” user with denied terminal write access was unable to receive the messages sent via the wall command.
#Sending the messages using the write command to the denied user
In this case, the write command directly prompts the sysadmin that the “david” user has disabled terminal write access.
Allowing Terminal Write Access
If you denied writable permission on your terminal intentionally or unintentionally and want to receive the messages sent by your sysadmin, then execute the following command to enable terminal write access:
$ mesg y -v
Once you allow write access to your terminal, any user in your local network attempting to send you messages via the wall or write command will be successful.
#Sending the messages using the wall command to the allowed user
As you can see from the above picture, if the user’s terminal access is enabled, then only the message sent by sysadmin or anyone else using the wall command will be received.
#Sending the messages using the write command to the allowed user
As you can see from the above picture, the sysadmin and “david” user are able to communicate with each other.
Now, before I end this article, I’d like to say that if the sysadmin (or sender) has turned off terminal write access, they can still use the wall command to send messages to everyone, but they can’t use the write command to talk to another user.
Apart from that, the rest of the things are self-explanatory, so I don’t think any additional things should be mentioned in this article.
However, if something is missing or if you have any questions or queries, then reach out to us via the comment section.
Till then, peace!
Join The Conversation
Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.