messaging local users

At times we might need to communicate with all users logged in the system about events that they should know about (e.g. planned or unplanned outages or reboots). We can send messages to all logged terminals (even those of users who deny messages by default if we are root) with the wall command:

# wall “Emergency outage will start in 5 minutes!!! Please save your work and logout now!!!”
# wall /etc/unplanned_outage.txt

The first example will send the given messages to all logged in users' terminals. The second one will do the same reading the input text from the given file.

On other occasions we might need to message a particular local user in private. As long as that user is logged in a terminal and it has not executed the command “mesg n” to disable incoming chats (if the sender is super-user it will be overridden), what you write in the prompt will show in the user's terminal and what he/she writes will be shown in yours:

root:/etc> write john
Message from on pts/0 at 15:10 ...
hi john

We can either write to whatever terminal john has used last (happens automatically by default), or we can specify a particular terminal:

root:/etc> write john pts/3

As said before, if we do not want other unprivileged users to chat to us, we can execute “mesg n” in our terminal to effect that change and “mesg y” to go back to its default.



<< netcat