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
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
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
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
.
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.