7.5 Set 'mesg n' as Default for All Users - /etc/profile mesg = n

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.

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/611

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-6b., CSCv6|3.1

Plugin: Unix

Control ID: 046e5cfbe3d725163ba2786930ab4ac415804754e63362a7411eb295d44e061a