Linux Machines

How to send messages to users logged into your Linux machines

Linux is an outstanding solution for your data center. It's incredibly flexible, stable, secure, and reliable. In fact, there's very little the open source platform can't do. That means you might have users logging into any number of your Linux servers for development purposes, testing, usage, etc. But what happens when you want to send all of those logged in users a message without having to blast a company email or place numerous phone calls? Since this is Linux, it's not only possible, it's also very easy.

I'm going to show you how to do this, however it must be noted there is one caveat--you can only send messages to all users who are logged into a terminal window. Although there are plenty of tools to send messages to a desktop, they don't allow widespread sending, or even sending to specific users, due to security issues. Because of this, you are limited to sending messages via the terminal window. Of course, the likelihood you'll have users logged into a graphical environment on your data center servers is next to /dev/null so the terminal is a fine solution.

I'm going to show you how to send a message to a specific user, and then to all users. There will be no need to install any software, as your Linux distribution will include everything you need. With that said, let's send a message.

Messages to specific user

The first thing you need to do is log into the server in question via SSH. Once logged in, you'll need to know is who is logged in. To find out what users are logged in, issue the command who. Anyone who is logged in will be displayed, along with the IP address of their originating machine--

echo "This server is going to be released!" | write ezicom_net

Sending a message to all users

Say you have a large amount of users logged in, and you don't want to have to send them individual messages. To blast a global message to the system that will be reached by all logged in users, you could issue the command:

wall "System is under creating under eZicom & railsserver!"