To create a custom start-up message that displays after login, edit the message of the day file, /etc/motd. Its contents are printed to every user right after a successful console or SSH login. It is a good place for a server name, a warning notice or maintenance information.
Prerequisites
- Root access to the server (or sudo).
- Any text editor. This guide uses vi; see Show Line Numbers with Vi for a few vi basics.
1. Open a root session
Open a terminal session, and elevate privileges to root

2. Edit /etc/motd
from here type the following command:
vi /etc/motd
type in what you would like it do display (press i first to enter insert mode)

save and quit by using ctrl+c (or Esc) to leave insert mode, then:
:wq
The file is plain text, so anything you type is shown exactly as written. Keep it short. Long banners scroll away and people stop reading them.
3. Verify
from here close your terminal session, and re-open

as you can see, the text added to the config file has been displayed. You can also test from the server itself with ssh localhost, or just view the file with cat /etc/motd.
Newer releases: /etc/motd.d
On RHEL, AlmaLinux and Rocky Linux 8 and later, /etc/motd still works the same way. Those releases also read drop-in files from /etc/motd.d/, which is where packages such as Cockpit add their own login hint. Putting your banner in a separate file, for example /etc/motd.d/10-banner, keeps it apart from anything a package writes.
Show a warning before login instead
The MOTD only appears after a user has logged in. A legal or “authorized use only” notice is usually shown before authentication as well:
/etc/issueis displayed on the local console before the login prompt.- For SSH, put the text in
/etc/issue.net, setBanner /etc/issue.netin/etc/ssh/sshd_config, and restart sshd (service sshd restart, orsystemctl restart sshdon systemd releases).
Troubleshooting
- Nothing shown over SSH: check that
PrintMotdis not set tonoin/etc/ssh/sshd_config. - Shown for some users but not others: a file named
.hushloginin a user’s home directory suppresses the MOTD for that user. - Banner from another tool: scripts in
/etc/profile.d/can also print text at login, so check there if you see a message that is not in/etc/motd.
to get a Hosted Linux Server, or for a Linux consultant, visit www.zwiegnet.com/go to get more information
Related guides: Show Line Numbers with Vi | Patching and Installing Updates on CentOS
