How do I opt out of recieving broadcast messages?

13,246

Solution 1

The command mesg n opts out of all messages. There is no way to prevent a specific user from sending you wall (Write ALL) message outside of removing execute permissions to the wall command for that user. The default permissions on my Ubuntu Linux computer allows for anyone to run wall and it will send messages to anyone who hasn't opted out with mesg n. Last note on this issue, just run mesg to see the current Opt-in/out status for receiving messages.

Solution 2

The first thing I would do would be to report this clown to the admins. Unfortunately there's no easy way for you to block him and only him.

The command to keep other users from writing messages on your terminal is mesg n. The mesg y command then allows writing again.

What this command does is to change the permissions of your terminal device file (e.g. /dev/tty0 or /dev/pts/8, etc.) to allow or disallow other users from writing to it. Typing who am i at the command prompt will often show you the name of your device, with the /dev/ prefix stripped off.

The traditional UNIX permission system allows you to set permissions separately for yourself, for a single user group, and for all other users. If you and everyone you want to talk to happen to be a member of a group that the h4x0r is not in, it's possible you could chgrp mygroup /dev/myterminal to set the file's group, then chmod 620 /dev/myterminal to set the permissions. (620 is shorthand for "user can read/write, group can write, all others have no permissions".)

Applying an access control list to your device file might be a way to do what you want, but that's system-dependent and non-standard, I've never done it, and it could cause problems for others if the login system isn't expecting it.

Finally, for more info (just in case you don't know already), try the man command -- man chmod, man chgrp, etc.

Share:
13,246
jones
Author by

jones

Updated on September 18, 2022

Comments

  • jones
    jones over 1 year

    I am logged in to a university system and a very annoying n00b thinks he or she is some awesome hacker because she or he can broadcast an object dump to everyone using pipes. I bet they think it is funny because it looks like the matrix.

    I was just wondering if there is a quick and easy way to opt out of recieving these messages from this user. Also what would be the command for all users (sometimes I would not want to recieve a message when I am in the depths of a difficult problem).

  • N.N.
    N.N. about 11 years
    Your answer would be more helpful if it explained and motivated the given commands.
  • lindhe
    lindhe over 4 years
    Setting the setgid or setuid bit can be very dangerous. Be careful with following this advice.