48. User Management - Communications Between Users
Contents
Linux provides users with tools to communicate with each other. Some can send messages to a specified user; some can send a group of messages; some can even send content as an email to a user’s inbox list.
Send Message to a Specific User
Before we send information to a user, we first need to know which terminal the message receiver is at:
|
|
When we know the terminal of the message receiver, we can send some messages to the terminal:
|
|
When the message is sent, the receiving terminal should print out the content just sent out by the root terminal:
Disable or Enable Messaging Function
We can use the mesg command to turn on or off the ability to send and receive messages.
Here are two arguments for mesg command:
Option | Meaning |
---|---|
n | Disable send and receive functions. This parameter is not valid for messages sent from root. |
y | Enable send and receive functions. |
We can set root to not receive or send messages:
|
|
When a user attempts to send a message to root, the system displays that root has disabled the messaging feature:
|
|
Group Messaging Function
We can use the wall command to broadcast messages to all users:
|
|
When the message is broadcasted, the receiving terminals should print out the content just sent out by the root terminal:
Output the Message Without the Banner
With the -h option, the message sent does not display the sending host:
|
|
When the message is broadcasted, the receiving terminals should print out the content just sent out by the root terminal without the banner:
Send an Email to a User
We can send mail to users based on mail, but we first need to install the mailx package:
|
|
We can try sending an email to root:
|
|
The root user’s terminal should prompt a message:
We can view the newly received mail through the mail command:
|
|
When we have finished checking the e-mail, we can terminate the program by pressing the Ctrl + D key combination.
References WRITE(1), MESG(1), WALL(1), GNU Mailutils
Author Dong Chen
LastMod Wed Mar 20 2019