Send message to all user linux

How to Send Broadcast Message to Logged-in Users on Linux Terminals

Linux is a multi-user operating system that allows multiple users to log in and use the system. This implies that at any given time, you might have several users logged in.

Sometimes, you might need to send a message or notification to all the users without necessarily placing a phone call or sending them emails. This is mostly when you want to announce a maintenance task or instruct them to log out.

In this guide, we will demonstrate how you can send messages to all logged-in users in the system. This only applies to users who are logged in via a terminal window using an SSH client such as PuTTY.

Send Messages to Logged-in Users Using the Wall Command

The wall command is a command-line utility that displays messages to all logged-in users on the terminal.

The wall command takes the following basic syntax:

If no file is specified, then the wall command reads the message from standard input and broadcasts it to all logged-in users.

For example, the following command reads the message enclosed in quotation marks as the argument and sends it to all logged-in users

# wall "The system will be shutting down at 1500HRS for maintenance. Apologies for any inconvenience caused".

Send Broadcast Message to Users in Terminal

When viewed from a logged-in user (in this case bob), the message appears as shown on the terminal window.

Broadcast Message from Root

To display a message from a file, invoke the wall command followed by the file name as shown.

View Broadcast Message from File

This is how the user receives the message on the terminal.

Broadcast Message To User

Send Messages to a Specific Logged-in User

Alternatively, you can use the write command to send a message to a specific user. To list all the currently logged-in users, invoke the who command:

Show Logged-In Users on Linux

For example, to send a message to a user called winnie and notify her about a system restarting in the next 3 hours, run the following write command with the echo command.

$ echo "This system will be restarted in 3 hours" | write winnie

On the user’s terminal, the message will appear as shown.

Send Message to User in Terminal

Conclusion

We have covered various ways of sending a message or notification to logged-in users using the wall and write commands. We hope that you can now send messages to logged-in users without a problem.

Источник

Wall Command in Linux with Examples

In a Linux environment, there are scenarios when multiple users are working on the server simultaneously through SSH. However, sometimes system admin needs to restart or shut down the system due to e.g. system maintenance, kernel upgrade, adding or removing hardware from the server. If this is the case, the system admin should inform all logged-in users to save their work. Email does not fit in this situation, as you first have to find out who is logged in and then sending emails to them. Also, you do not know when the user will read the email. Luckily, there is a Linux command “wall” that allows you to do this easily.

Читайте также:  Совместимость astra linux kaspersky

Here, we are going to describe the usage of wall command in Linux. Remember, the wall command works the same for all Linux distributions.

Note: Wall command only displays the message on the Terminal window of logged-in users. Users working only on GUI, with no Terminal window open will not be able to see the messages.

Linux Wall Command

Linux Wall command allows you to send a message or the contents of a file to all the currently logged-in users. If no file or message is specified, wall command reads the message from the stdin (standard input).

Wall Command Syntax

The syntax for wall command is as follows:

Send a Message to All Users

To send a message to all the currently logged-in users, type wall followed by the message you want to send.

This command will send the message to all the logged-in users with a Terminal window open.

Note: For some Linux distributions, you have to execute the above command as super user. Also, if a user has chosen to deny messages to their Terminals (like using the mesg command), then only a sudo user will be able to send messages to their Terminals.

Following are the outputs displayed to two users “linuxways” and “ummara” who are logged-in to the server via SSH. These users are working from the system running Ubuntu and Debian.


The wall command also reads the message from stdin (standard input). To do so, simply type wall and hit Enter.

After that, type any message or messages you want to send to logged-in users. Once you are done typing the messages, press Ctrl+D to send those messages.

Here is the output which all logged-in users received on their Terminal.

Send a Message from a File

If there are some messages that you have to repeat often, you can simply type them in a file. When you have to send those messages to the logged-in users, simply call that file with wall command. Remember, you will require sudo privileges if you want to send a message from a file.

For example in the following output, file content has been first shown using the cat command. Then to send the message contained in the file, the filename is passed to the wall command.

These are the outputs (from the file msg.txt) received by the logged-in users.

Send a Message to a Group

Instead of sending the message to all logged-in users, you can send it to only the members of a group who are currently logged in to your system. The syntax is as follows:

For example, to send a message to a group named “sshusers”, the command would be:

All the members of the “sshusers” group who are currently logged in to the server will receive the specified message.

Suppress Banner

The wall command displays a banner before displaying a message as can be seen in the following screenshot.

Читайте также:  Установка freeipa alt linux

To suppress this banner, use the -n option with the wall command:

For example, the following command will only display the specified message while suppressing the banner.

All the logged-in Terminal users will receive the message without a banner.

View Version Information

To view the version of the wall command, use the following command:

The following output shows the version of the wall utility is 2.34.

Wall is a handy utility that helps a multi-user system admin to quickly notify other users to save their work before a system shutdown or reboots. In this article, we covered how to use the wall command to communicate with logged-in users. Hope you find it interesting and useful.

About the author

LinuxWays Team

We create HowTos and Tutorials for Sys Admins. Visit us on LinuxWays.net

Источник

How to Send a Message to Logged Users in Linux Terminal

How can I send a messages to logged on users in a Linux server? If you are asking this question, then this guide will help you learn how to do that. We will demonstrate how to send a message to all or a specific logged on user, on the terminal in Linux.

Linux offers a variety of means for sending messages to users logged on to a server as explained in the two methods below.

In the first method, we will use wall command – write a message to all currently logged in users on the terminal as shown.

# wall "System will go down for 2 hours maintenance at 13:00 PM"

Send Message to Logged Users

To disable the normal banner printed by wall, for example:

Broadcast message from [email protected] (pts/2) (Sat Dec 9 13:27:24 2017):

Add the -n (Suppress the banner) flag, this however, can only be used by the root user.

# wall -n "System will go down for 2 hours maintenance at 13:00 PM"

In the second method, we will use write command, which comes pre-installed on all if not most Linux distributions. It allows you to send a message to another user in the terminal using tty.

First check the all logged on users with the who command as shown.

Find Logged in Users

There are currently two users are active on the system (tecmint and root), now the user aaronkilik is sending a message to the root user.

$ write root pts/2 #press Ctrl+D after typing the message.

Send Message to User

That’s all! Do share with us other methods or commands for sending messages to all logged on users through the terminal in Linux. If you have any queries, please use the feedback form below.

Источник

Thread: Howto send a broadcast message to all users?

jackel7007 is offline5 Cups of Ubuntu

Howto send a broadcast message to all users?

I’m looking for a solution to broadcast messages on the network.
All systems are Linux / Ubuntu.

It would be used in case the server has to be rebooted.
It saves me a walk to every office in the building.

jackel7007 is offline5 Cups of Ubuntu

Re: Howto send a broadcast message to all users?

So far I have found a sort of solution.
This solution uses a combination of samba and linpopup.

Since we are only using Ubuntu in our network, we don’t want to install samba.
(Just for messaging purposes).

So anybody knows any other solution?
Maybe we could use a messenger like tool, but it has to popup on top of everything.
And we need the option to sent to all users at once.

Читайте также:  Alt linux настройка proxy

wojox is offline

I Ubuntu, Therefore, I Am

Re: Howto send a broadcast message to all users?

jackel7007 is offline5 Cups of Ubuntu

Re: Howto send a broadcast message to all users?

Thanks for your reply, but it’s not what I meant.
Problem is, that people are working on our server with applications like Frontaccounting, Sugarcrm and Xoops.

So I would like to be able to broadcast a message from this server to all clients on the network. Using this, I can inform people of the fact that the server will for example be rebooted in 15 minutes.

The people who need to receive the message are not logged in on the system using SSH or whatever. All of the applications used by the users are web-based. So their in fact apache users and they don’t have an user account on the system.

Iowan is offlineExpired admin

Re: Howto send a broadcast message to all users?

jackel7007 is offline5 Cups of Ubuntu

Re: Howto send a broadcast message to all users?

Doesn’t Man Wall only sent a message to the users logged in on the system?
(either local or remote)

From what i tested this doesn’t sent a message to the users using the web-server.
(our users are constantly using SugarCRM, so I want to sent a broadcast to them in case of server reboot)

jackel7007 is offline5 Cups of Ubuntu

Re: Howto send a broadcast message to all users?

I would swear that what i want to accomplish, is not that odd.
I can’t imagine that in the bigger companies the system administrator walks or calls to everyone to inform them about the upcoming server maintenance?

It doesn’t matter what program i use, or how i have to use it, the only requirment is that i can type the message once, and so it is displayed to all desktops in the company.

inobe is offlineI Ubuntu, Therefore, I Am

Join Date Nov 2008 Location United States Beans 2,090 —> Beans 2,090 Distro Kubuntu 11.10 Oneiric Ocelot

Re: Howto send a broadcast message to all users?

QuoteOriginally Posted by jackel7007 View Post

I would swear that what i want to accomplish, is not that odd.
I can’t imagine that in the bigger companies the system administrator walks or calls to everyone to inform them about the upcoming server maintenance?

It doesn’t matter what program i use, or how i have to use it, the only requirment is that i can type the message once, and so it is displayed to all desktops in the company.

install pidgin, add an account, select bonjour.

it basically uses zeroconf, it’s a simple lan/ ip messenger.

if that’s not what you need i can have a look around ?

AggravatedGestalt is offlineJust Give Me the Beans!

Re: Howto send a broadcast message to all users?

QuoteOriginally Posted by inobe View Post

install pidgin, add an account, select bonjour.

it basically uses zeroconf, it’s a simple lan/ ip messenger.

if that’s not what you need i can have a look around ?

Well, no hijacking intended, but without installing anything, is there another way? I admit, this may seem dumb, but for example, I have a logged-in «safety» user via ctrl+alt+F2, and when I alt+F7 to my admin user and broadcast a message with wall, the «safety» user receives no message despite receiving the message on the admin user’s terminal. If this is off subject, please say so, and I will edit my post to blank.
Edit: I had to:
mesg y
as the «safety» user. Is there a way to force messages to all users even if messages are set to n?

Источник

Оцените статью
Adblock
detector