Linux Administration Cookbook
上QQ阅读APP看书,第一时间看更新

Setting a message of the day (motd)

Providing your PrintMotd setting is set to yes, you can have users see the contents of /etc/motd when they log in.

First, ensure that it is set to yes in the SSH daemon config:

#PermitTTY yes
PrintMotd yes
#PrintLastLog yes

Next, restart the SSH daemon, and then modify the /etc/motd file to something sensible. Alternatively, you can use the following command:

sudo sh -c 'echo "This is a testing system, how did you get here?" > /etc/motd'

This message will now be printed whenever you log in.

This feature is usually used by companies to warn bad actors who are attempting to gain access to their systems. Occasionally, it's used by bored system administrators to quote Futurama at you.