DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
VGSOURCES
Get listed

DebianPATCH 2026.10.15

How to Customize the Message of the Day (MOTD) on Linux

By VGSources Team 9 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Linux does not have one universal MOTD file. After a successful login, the PAM pam_motd module may print static files, generated fragments, or both. On Ubuntu and Debian, the usual source is the update-motd framework: executable scripts in /etc/update-motd.d are run at login and their output is assembled into /run/motd.dynamic. On systems using a static configuration, edit /etc/motd instead.

The reliable way to customize the message is therefore to identify which PAM files and login service are active, then choose a static file, a generated script, or a local motd.d override. The procedures below also explain why an edit may appear on a console but not through SSH, how to disable one vendor-supplied line, and how to avoid slowing every login or exposing sensitive information.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How Linux decides what to display

The MOTD is normally displayed by the PAM session module pam_motd.so after authentication succeeds. PAM can be invoked by a local console login, an SSH session, a display manager, or another service, so the visible message depends on that service’s PAM policy.

In the documented pam_motd arrangement, the module examines message files and directories such as /etc/motd, /run/motd, /usr/lib/motd, and their corresponding motd.d directories. Entries are printed in lexicographic order. A file in /etc takes precedence over a same-named file in /run or /usr/lib, which lets administrators replace or suppress packaged content without editing vendor files.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses | Anti UV Ray, For Computers & Gaming, Square Frame, Eyewear for Men and Women
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Each individual message is limited to 64 KB according to the current Ubuntu Manpages documentation for pam_motd. That limit applies to a message file or fragment, not to an unlimited stream of diagnostic output. Keep generated output short enough to remain useful at a login prompt.

Static, generated, and fragment-based sources

Approach Typical location When it is read Best use Main caution
Static file /etc/motd When the active PAM setup reads it directly A fixed notice such as an authorization or maintenance message On generated Ubuntu systems it may be a symlink or may be bypassed
Ubuntu/Debian dynamic scripts /etc/update-motd.d/ Scripts run as root at login Hostname, kernel, update, storage, or other changing status Slow or unreliable commands delay every login
MOTD fragments /etc/motd.d/, /run/motd.d/, /usr/lib/motd.d/ Fragments are read in sorted order Local additions and per-message overrides Names and precedence determine the result

Identify the active MOTD mechanism first

Do not overwrite a file blindly. A quick inspection shows whether your host uses a generated message and whether the relevant PAM service invokes pam_motd.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Check the main files and directories:
ls -l /etc/motd /run/motd /usr/lib/motd 2>/dev/null
ls -ld /etc/motd.d /run/motd.d /usr/lib/motd.d /etc/update-motd.d 2>/dev/null

If /etc/motd points to /run/motd.dynamic, the visible text is generated rather than maintained as a hand-edited file.

  1. Inspect the PAM policies for the login paths you care about:
grep -R --line-number 'pam_motd' /etc/pam.d/login /etc/pam.d/sshd 2>/dev/null

A line such as session optional pam_motd.so indicates that PAM will attempt to print the MOTD for that service. The exact options and included files matter, so read the surrounding lines rather than changing a single match in isolation.

  1. For SSH, inspect the daemon configuration as well:
sshd -T | grep -i '^printmotd'

If your distribution does not permit that command as an unprivileged user, run it with the required administrative privileges. The effective setting may come from an included configuration file, not only from the top-level sshd_config.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Set a fixed message in /etc/motd

Use a static file when the message should be identical at every login and your PAM configuration reads /etc/motd directly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Create or replace the file with administrative privileges. This example writes two lines and ends the file with a newline:
sudo sh -c 'cat > /etc/motd <<"EOF"
Authorized users only.
Maintenance window: Sundays 02:00 UTC.
EOF'
  1. Log out and start a new session, or invoke the same login path again. A shell that was already open will not normally redraw the MOTD.
  2. If nothing changes, check whether /etc/motd is a symlink, whether a generated file is being displayed, and whether the relevant PAM stack contains pam_motd.so.

Do not treat a successful write as proof that this is the active source. Ubuntu installations commonly make /etc/motd a link to generated output; a later login can regenerate that target and replace text you typed manually. In that case, move the customization to an update-motd.d script or an appropriate motd.d fragment.

Create a dynamic MOTD on Ubuntu or Debian

Ubuntu introduced the update-motd framework, in which a collection of scripts dynamically assembles the MOTD at login. Executable files in /etc/update-motd.d run as root, and their standard output is concatenated into /run/motd.dynamic. The framework is a Debian/Ubuntu-specific patch and is not guaranteed to exist on other Linux distributions.

Add a custom fragment

Create a file with a numeric prefix, no filename extension, executable permissions, and a final newline. A prefix in the 90 range usually places local information after lower-numbered distribution scripts:

sudo tee /etc/update-motd.d/90-custom >/dev/null <<'EOF'
#!/bin/sh
echo
echo "Welcome to $(hostname)"
echo "Kernel: $(uname -r)"
EOF
sudo chmod 755 /etc/update-motd.d/90-custom

The script must write the intended message to standard output. Avoid writing status text to standard error unless you deliberately want diagnostics to appear elsewhere. Keep the script deterministic and quick; it runs for every login that triggers generation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men | Office Gifts for Women, iPhone Stand, Gadgets for Men, Office Decor, Gaming Desk Accessories for Samsung Fold 8, Switch, iPad
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Preview the generated output

Where the framework is installed, run the same run-parts mode used by the update scripts:

sudo run-parts --lsbsysinit /etc/update-motd.d

This prints the combined output without requiring a new SSH connection. It also exposes filename mistakes, permission problems, and commands that fail when run as root.

Rules that determine whether a script runs

  • Use a name such as 90-custom; omit extensions such as .sh.
  • Make the file executable. A non-executable file is skipped.
  • Follow the filename rules used by run-parts --lsbsysinit; unusual punctuation can cause a file to be ignored.
  • Write a newline-terminated result so the next fragment does not run into the last line.
  • Use absolute paths for commands whose environment may differ from an interactive shell.

Control ordering and override packaged fragments

Dynamic scripts are run in numeric and then alphabetical order under the run-parts --lsbsysinit rules. A file named 10-system therefore appears before 90-custom. Within the fragment-based motd.d mechanism, files are likewise displayed in lexicographic order, with the /etc tree taking precedence over same-named entries in lower-precedence trees.

Use /etc/motd.d for a local fragment when your system reads that directory directly. This avoids modifying files owned by packages and makes the ownership of your message clear.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Silence one specific line

To suppress a packaged fragment without deleting it, create a same-named symbolic link in /etc/motd.d that points to /dev/null. For example:

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
sudo ln -s /dev/null /etc/motd.d/50-motd-news

The name must exactly match the lower-precedence fragment you want to mask. The /etc entry wins during precedence resolution, while the package’s original file remains available for upgrades or later restoration. Verify the actual filename first with:

find /usr/lib/motd.d /run/motd.d -maxdepth 1 -type f -printf '%fn' 2>/dev/null | sort

If the file is generated by update-motd rather than read from a motd.d directory, this symlink will not disable it; disable or adjust the corresponding numbered script instead.

Make the change appear over SSH

SSH output can be controlled by two separate layers. Debian documentation describes an sshd option named PrintMotd, while the PAM stack determines whether pam_motd.so runs for the session. A console login and an SSH login can therefore show different messages even on the same machine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnose a console/SSH mismatch

  1. Compare the effective SSH setting:
sshd -T | grep -i '^printmotd'
  1. Check /etc/pam.d/sshd for a pam_motd.so session line and inspect any included files.
  2. Check /etc/pam.d/login separately for local virtual-console behavior.
  3. Open a fresh SSH session after each change; existing sessions do not replay the banner.

If PrintMotd is disabled, enabling PAM alone may not produce the result you expect, and changing PrintMotd alone cannot help if the SSH PAM stack never invokes pam_motd.so. Change only the layer responsible for the path you intend to affect, then validate the daemon configuration before reloading it.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Understand distribution boundaries

The /etc/update-motd.d convention is not an upstream Linux standard. The Debian MOTD documentation describes it as a Debian- and Ubuntu-specific patch that may be absent from other GNU/Linux distributions. Other systems may use only /etc/motd, the motd.d directories, vendor login tooling, or a different PAM arrangement.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

On an unfamiliar distribution, start with the PAM files for the actual login service and list the available MOTD paths. Do not create /etc/update-motd.d and assume it will be called automatically. If no PAM rule references pam_motd.so, the login program may be displaying a banner through another mechanism, or no MOTD may be configured at all.

Keep MOTD scripts safe and fast

Protect sensitive information

MOTD text is shown to every account that can log in through the affected service. Avoid putting secrets, access tokens, private hostnames, internal IP ranges, unpatched-service details, or command output that ordinary users should not see. Treat kernel versions, package status, mounted filesystems, and uptime as operational information that may still reveal useful details to an attacker.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prevent login delays

Every command in an update-motd.d script runs in the login path. Network probes, package-manager queries, DNS lookups, and large disk scans can make an otherwise healthy server feel hung. The Ubuntu update-motd manual recommends caching long-running or network-dependent work rather than performing it synchronously for each login.

Prefer local, bounded commands such as hostname and uname -r. If you need a health check, have a separate timer or service refresh a small cache file and let the MOTD script read that file with a short timeout and a sensible fallback.

Handle failures quietly

Use shell checks for missing commands and unavailable files. A failed optional check should produce a short fallback or no line, not a stack trace. Test scripts as root with the same interpreter named in the shebang, because permissions, environment variables, and working directories differ from an interactive shell.

Troubleshooting by symptom

Editing /etc/motd has no effect

  • Check whether /etc/motd is a symlink to /run/motd.dynamic.
  • Look for /etc/update-motd.d and preview it with run-parts --lsbsysinit.
  • Verify that the login service’s PAM file includes pam_motd.so.
  • Confirm that you are testing a new login rather than an existing shell.

The custom Ubuntu script is ignored

  • Ensure the file is executable: sudo chmod 755 /etc/update-motd.d/90-custom.
  • Remove the extension and unsupported punctuation from its filename.
  • Check the shebang and run it directly as root to expose syntax or command errors.
  • Run sudo run-parts --lsbsysinit /etc/update-motd.d and inspect whether its output appears.

Only one vendor line must be removed

  • For a motd.d fragment, create a same-named /etc/motd.d symlink to /dev/null.
  • For an update-motd.d script, disable or edit that numbered script instead.
  • Do not delete package-managed files when a precedence override can solve the problem.

The message appears locally but not over SSH

  • Check the effective PrintMotd value from sshd -T.
  • Inspect /etc/pam.d/sshd independently of /etc/pam.d/login.
  • Check for another SSH banner configured with the Banner directive; it is a separate mechanism from the post-authentication MOTD.
  • Reconnect after applying a configuration change.

The login is slow after customization

  • Run each custom script manually and time commands that contact the network or scan the filesystem.
  • Move expensive work to a scheduled job and have the MOTD read cached results.
  • Add timeouts and fallbacks so a failed service cannot block authentication feedback.

A repeatable change-and-verify procedure

  1. Identify the login path: local console, SSH, display manager, or another service.
  2. Inspect that service’s PAM configuration for pam_motd.so.
  3. Determine whether the source is static, motd.d, or Ubuntu/Debian update-motd.
  4. Choose a local file or fragment rather than editing package-owned content.
  5. Use a clear numeric name, executable mode, standard output, and a final newline for dynamic scripts.
  6. Preview generated output with run-parts --lsbsysinit when available.
  7. Open a fresh session through the intended service and verify ordering, visibility, and timing.
  8. Record any suppression symlinks or local scripts so future administrators know why a packaged line is absent.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

DebianLinuxMOTDPAMSSHsystem administrationUbuntu

Leave a reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.