Loading...

Lab 30: Communicating with Users

Notify active users about an upcoming maintenance window using the built-in terminal messaging tools. Identify active sessions, broadcast a message to all users, and send a targeted message to a specific TTY.

users core boot

Scenario

A scheduled maintenance window is about to begin. You need to alert everyone currently logged into the host, then notify a specific user that they still have an open session and should log off before the work begins.

Operator context

This is the kind of quick comms you do right before a reboot, patch cycle, storage maintenance, or network change.

Objective

  • List who is logged in and capture TTYs.
  • Broadcast a one-line message to all users.
  • Send a targeted message to a specific user session.

Concepts

  • You cannot message a specific session without the TTY. Use who when the target matters.
  • users is a fast glance, but it drops session context. Use it when you only need names.
  • wall is broadcast. Keep the message short, time-bound, and actionable so users can respond quickly.
  • write is session-targeted. It is useful for the last straggler you need off the host before maintenance.
  • Messaging can be blocked by user settings. If the target has messaging disabled, you will need another channel.

Walkthrough

Step 1 : View currently logged-in users and their TTYs.
Command
who

who is the preferred tool when you need to target a specific session because it includes the TTY, for example pts/2.

devstudent pts/0  2025-07-19 08:31 (:0)
sysmon     pts/1  2025-07-19 08:33 (10.0.0.15)
analyst    pts/2  2025-07-19 08:34 (10.0.0.42)
Alternate
users

users is a quick glance at who is logged in, but it does not show TTYs, so it is weaker for targeted messaging.

devstudent sysmon analyst
Step 2 : Broadcast a system-wide maintenance message.
Command
wall "System maintenance starts in 10 minutes. Please save your work."

wall writes to all logged-in terminals. Keep it short, actionable, and time-bound.

Broadcast message from root@server01 (tty1) (Fri Jul 19 08:35:12):
System maintenance starts in 10 minutes. Please save your work.
Step 3 : Send a private message to a specific TTY using write.
Command
write analyst pts/2

write targets one session, so the TTY must match what you discovered in Step 1. After starting the write session, type your message and press Ctrl+D to send.

[write session open - type your message and press Ctrl+D to send]
Hi analyst, please log off before 08:45 for scheduled maintenance.
[Message sent]
Step 4 : Confirm whether messaging is enabled for the target.
Command
who -T

If the target has messaging disabled, write will fail. The who -T output shows whether each session accepts messages.

devstudent + pts/0  2025-07-19 08:31 (:0)
sysmon     - pts/1  2025-07-19 08:33 (10.0.0.15)
analyst    + pts/2  2025-07-19 08:34 (10.0.0.42)

Breakpoints

write says messaging is disabled

The target user may have used mesg n. Verify with who -T. If the session is not accepting messages, use another communication channel.

No TTY shown

If you only ran users, you do not have the TTY. Run who to get the exact terminal name before using write.

wall did not appear

Some terminals or environments may not display wall output as expected. Confirm you have logged-in sessions and that they are real TTYs.

Cleanup checklist

  • Confirm the announcement was delivered.
  • Confirm the targeted user logged off.
Commands
who
last | head

Reference

  • who: Show logged-in users with TTY and source.
  • who -T: Show logged-in users and whether each session accepts messages.
    • +: messaging allowed
    • -: messaging disabled
    • ?: unknown
  • users: Quick list of usernames logged in (no TTY info).
  • wall <message>: Broadcast a message to all logged-in terminals.
  • write <user> <tty>: Send a message to a specific user session; finish input with Ctrl+D.
  • mesg y|n: Enable or disable messages to your terminal.