4

How do you block unix/linux wall messaging?

Example: 
SSH somemachine
WALL annoy the s*** out of people on machine

Desired goal: deny wall on owned machine

7
  • Could you simply uninstall the program? Or remove the executable flag on it?
    – jasonlfunk
    Mar 20, 2012 at 19:32
  • I'm not root on the desired machine. I'm looking for a way to suppress if for nothing else can be done Mar 20, 2012 at 19:34
  • If you aren't root on the machine, you aren't going to be able to do anything for anyone but yourself. Is that what you are asking for?
    – jasonlfunk
    Mar 20, 2012 at 19:37
  • Yes I dont want other people who ssh into the machine using 'wall' and plaster my terminals Mar 20, 2012 at 19:38
  • What does this question have to do with MySQL?
    – Dan Fego
    Mar 20, 2012 at 19:39

3 Answers 3

8

mesg n

From the man page

DESCRIPTION
   Mesg controls the access to your terminal by others.  It's typically used to allow or disallow other users to write to your terminal (see write(1)).

Edit:

This will not prevent root from sending wall messages

4
  • Alex - I dont care if root can message. Just other users Mar 20, 2012 at 19:35
  • then mesg n should do it for you
    – Alex
    Mar 20, 2012 at 19:37
  • Is there away to have it kick off in bashrc ? Mar 20, 2012 at 19:39
  • I believe so, .bashrc., .bash_profile or .profile will do
    – Alex
    Mar 20, 2012 at 19:41
5

Note that every user on the machine that does not want to see a wall message has to do mesg n. Putting mesg n in /etc/profile might do that for all users.

Alternatively, if you only want root to be able to run wall, change its permission: chmod 700 /usr/bin/wall.

1

The "mesg n" command shouldn't be run if you've sudo'd to another user, so it may be better to check whether the user owns the terminal, like:

test -O "`/usr/bin/tty`" && /usr/bin/mesg n

i.e., if the owner of the character special file output by "tty" is the effective user ID, run "mesg n". I think this is safe for /etc/profile and its cousins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.