7.5 Set "mesg n" as Default for All Users - login

Information

The "mesg n" command blocks attempts to use the write or talk commands to contact
users at their terminals, but has the side effect of slightly strengthening permissions on the
user's tty device.

Rationale:

Since write and talk are no longer widely used at most sites, the incremental security
increase is worth the loss of functionality.

Solution

Perform the following to implement the recommended state:

# cd /etc

# for file in profile .login ; do
if [ "`grep mesg $file`" ]; then
awk '$1 == "mesg" { $2 = "n" } { print }' $file > $file.CIS
mv $file.CIS $file
else
echo mesg n >> $file
fi
done

See Also

https://workbench.cisecurity.org/files/2582