How to limit messages from the wall command to a specific group?

The description for the wall command states that it sends a message to all logged in users. However, the man page describes a flag, -g --group, which allows the sender to limit messages to a specified group:

-g, --group group Limit printing message to members of group defined as a group argument. The argument can be group name or GID.

However, I am only able to send messages to all logged in users. I have tried this command with:

  • -g my_group,
  • --group my_group,
  • -g "my_group",
  • --group "my_group",
  • --group=my_group

In addition, I have tried all of the above by replacing "my_group" (the group name) with the group ID to no avail.

I have also tried placing the flags after the message. None of this works to limit the messages to a given group. All messages go to all users. Am I misunderstanding the flag? The syntax? Is this command broken? Or is the man page simply incorrect? Please do not offer alternative commands, I am aware of their existence. I want to know how to use a listed option or why the option is not working correctly. I am using Ubuntu 20.04

Asked By: Johnny

||

Looked at the group membership checking code. Had a round of gdb --args wall -g root foobarbaz,

break is_gr_member
run
{wait for breakpoint to be hit}
finish 
print utmpptr->ut_user # this prints my own user name
step # this shows we're actually taking the branch as if I was a member of group root

So, yeah, that’s a bug in wall‘s checking of group membership as it seems. Feel free to open a bug report on their bug tracker; however, honestly, the pressure to fix this should be very low! I doubt there’s many legitimate users of this feature. Fixing this yourself would probably be pretty valuable, still, and if you have the C skills, please do that.

Answered By: Marcus Müller
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.