Login banners warn users of authorised use policies and can have legal implications for intruders. This guide configures pre-login SSH banners, post-login MOTD messages, and terminal login warnings on Ubuntu 24.04 LTS.

Tested and valid on:

  • Ubuntu 24.04 LTS

Prerequisites

  • Ubuntu 24.04 LTS server
  • A user with sudo privileges

Step 1 – Create an SSH Pre-Login Banner

Create the banner file:

sudo nano /etc/ssh/banner

Add your banner text, for example:

*************************************************************
* WARNING: Authorised Access Only                           *
* Unauthorised access is prohibited and monitored.          *
* All activities are logged.                                *
*************************************************************

Step 2 – Enable the Banner in SSHD

Reference the banner file in the SSH config:

sudo nano /etc/ssh/sshd_config

Set:

Banner /etc/ssh/banner

Restart SSH:

sudo systemctl restart sshd

Step 3 – Customise the MOTD (Message of the Day)

Edit the MOTD shown after login:

sudo nano /etc/motd

Add your message, for example:

Welcome to MyServer — Ubuntu 24.04 LTS
Unauthorised access is prohibited. All activities are logged.
Contact: [email protected]

Step 4 – Disable Dynamic MOTD Scripts

Ubuntu generates a dynamic MOTD. Disable scripts you do not want:

ls /etc/update-motd.d/
sudo chmod -x /etc/update-motd.d/10-help-text
sudo chmod -x /etc/update-motd.d/50-motd-news

Step 5 – Add a Legal Warning to /etc/issue

/etc/issue shows before the login prompt on local/console logins:

sudo nano /etc/issue

Add:

Authorised users only. All access is monitored and logged.

Step 6 – Add a Banner for /etc/issue.net

/etc/issue.net is displayed by some remote login services:

sudo cp /etc/issue /etc/issue.net

Step 7 – Verify the Banner

Test by connecting from another terminal:

ssh -p 22 user@your_server_ip

Conclusion

Login banners and SSH warnings are now configured on Ubuntu 24.04 LTS. These serve as a legal deterrent and make explicit that the system is monitored. Always have legal counsel review banner text for compliance requirements.