Updated: 10 November 2026 · Applies to: Ubuntu 24.04 (OpenSSH 9.6p1), Debian 13 (OpenSSH 10.0p2), AlmaLinux 10.2 (OpenSSH 9.9p1); AlmaLinux 9.8 (OpenSSH config checked)

Linux can show two kinds of SSH welcome message. The message of the day (MOTD) appears after a user has logged in: put your text in /etc/motd. A pre-login banner appears before the password or key is checked, which suits a legal notice: put the text in /etc/issue.net and add Banner /etc/issue.net to the SSH server configuration.

Option 1: message after login (/etc/motd)

  1. Log in as root (or use sudo) and write your text to /etc/motd, for example:
    Welcome to web01.
    Maintenance window: Sundays 02:00 to 03:00 UTC.
  2. Log out and log in again. No restart is needed: the file is read at every login.

On all three systems we tested, PrintMotd no is set in the SSH configuration (Ubuntu and Debian in /etc/ssh/sshd_config, AlmaLinux 10 in /etc/ssh/sshd_config.d/50-redhat.conf). That is normal: the PAM module pam_motd prints the message instead, so do not switch PrintMotd on or users see it twice. You can check that PAM is set up for it:

grep motd /etc/pam.d/sshd

Output on Ubuntu 24.04:

session    optional     pam_motd.so  motd=/run/motd.dynamic
session    optional     pam_motd.so noupdate

On AlmaLinux and Rocky Linux you can also drop extra text files into /etc/motd.d/, for example /etc/motd.d/backup. According to the pam_motd manual, files there are shown in name order after /etc/motd, which lets different tools or teams keep their own message without editing one shared file.

Option 2: dynamic message on Ubuntu and Debian (update-motd.d)

Ubuntu builds part of the login message from scripts. According to the Ubuntu manual, executable scripts in /etc/update-motd.d/ "are executed by pam_motd as the root user at each login", in name order, and their output goes to /run/motd.dynamic. Debian 13 has the same folder (with a 10-uname script) and the same pam_motd lines.

  1. Create a script, for example /etc/update-motd.d/90-disk:
    #!/bin/sh
    echo
    df -h / | awk 'NR==2 {print "Disk / used: " $3 " of " $2 " (" $5 ")"}'
  2. Make it executable:
    chmod +x /etc/update-motd.d/90-disk
  3. To switch off a part you do not want, such as the help links or the news, remove the execute bit instead of deleting the file:
    chmod -x /etc/update-motd.d/10-help-text /etc/update-motd.d/50-motd-news
  4. Preview the result without logging in:
    run-parts --lsbsysinit /etc/update-motd.d

Output in our Ubuntu 24.04 lab container (the kernel line shows the host it ran on):

Welcome to Ubuntu 24.04.5 LTS (GNU/Linux 5.14.0-503.16.1.el9_5.x86_64 x86_64)

Disk / used: 32G of 48G (69%)

Keep these scripts fast. They run at every login, and a slow command (a network call, for example) delays every SSH session.

Option 3: banner before login (/etc/issue.net and Banner)

  1. Write the notice to /etc/issue.net:
    Authorised access only. All activity is logged.
  2. Tell the SSH server to send it. On current releases the main file includes /etc/ssh/sshd_config.d/*.conf near the top, so the cleanest way is a small drop-in file:
    echo "Banner /etc/issue.net" > /etc/ssh/sshd_config.d/10-banner.conf

    According to the OpenSSH manual, "the first obtained value will be used" for each keyword, so a drop-in that sorts early wins over a later line. Where there is no Include line, add Banner /etc/issue.net to /etc/ssh/sshd_config itself (it contains a commented #Banner none line you can replace).

  3. Test the configuration before you restart. Nothing is printed when it is valid:
    sshd -t

    A typo stops the test with exit code 255, for example:

    /etc/ssh/sshd_config.d/20-typo.conf: line 1: Bad configuration option: Banerr
    /etc/ssh/sshd_config.d/20-typo.conf: terminating, 1 bad configuration options
  4. Confirm the value the server will use:
    sshd -T | grep -i ^banner

    Output:

    banner /etc/issue.net
  5. Restart the SSH server. On AlmaLinux and Rocky Linux:
    systemctl restart sshd

    On Ubuntu and Debian:

    systemctl restart ssh
  6. Keep your current session open and test from a second terminal. In our test the banner appeared straight after the connection, before authentication:
    Authorised access only. All activity is logged.

Some clients hide the banner: in our test the OpenSSH client did not show it with -q or -o LogLevel=ERROR. Do not put anything secret in it, since anyone who connects sees it before logging in.

Hide the message for one user

According to the OpenSSH manual, an empty ~/.hushlogin file in a user's home folder suppresses the last login time and /etc/motd when sshd prints them itself (PrintLastLog and PrintMotd on), and it never hides the Banner. On the systems above the MOTD comes from pam_motd instead, so check the result after a test login. For per-user MOTD and banner rules see How to Set or Disable the Login Banner and MOTD for Specific Users.

Related guides

Official documentation: sshd_config(5), update-motd(5).

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket