Question

How to talk with other users connected to the Server

I’ve recently had a case where I needed to talk with another user that was connected to the Droplet with SSH which prompted me to write this quick mini-tutorial.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
May 13, 2024
Accepted Answer

To communicate with another user who is connected to the same server via SSH, you can use several command-line utilities available on most Unix-like systems. The most commonly used commands for sending messages to other users on the same server are write, wall, and talk. Here’s how to use each of them:

1. Using the write Command

The write command sends a message to another user who is logged in by specifying their username and the terminal name (if they are logged in multiple terminals). You can see the terminals with the who command.

who
  • This command shows a list of all logged-in users, their terminals, and other login info.

  • Send a message:

write username tty
  • Replace username with the user’s username and tty with their terminal name from the who output. After executing the command, you can start typing your message. Finish by pressing CTRL+D to end the message.

2. Using the wall Command

The wall (write all) command sends a message to all logged-in users. This is particularly useful for sending system-wide notifications.

  • Send a broadcast message:
wall "Your message here"
  • Simply type wall followed by your message enclosed in quotes. You might need superuser privileges depending on your system’s configuration.

3. Using the talk Command

The talk command allows a two-way interactive communication between two users.

Initiate a talk session:

talk username [tty]
  • Replace username with the user’s username. The tty is optional if the user is logged in at more than one terminal. The user on the other end will see a message asking if they accept the talk request.

4. Using mesg Command

Before using write or talk, it’s good practice to check if the user has allowed messaging through the mesg command. Users can control whether they receive messages from other users with this command.

  • Enable or disable receiving messages
mesg y  # Enable
mesg n  # Disable

5. Examples:

Here is a practical example of how to use these commands:

  1. Check who is online:
who
  1. Send a message using write:
write johndoe pts/1
  1. Broadcast a message using wall:
sudo wall "Server will restart in 10 minutes."
  1. Start a talk session:
talk johndoe pts/1

Remember that for write and talk, the user must have their message setting enabled (mesg y). These methods are straightforward for quick and direct text-based communication on servers where multiple users are logged in via SSH.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel