Update SSH banner for DD-WRT

03 May 2020

By default logging into dd-wrt via ssh the pre-login sshd banner looks like this:

DD-WRT v3.0-r42054 std (c) 2020 NewMedia-NET GmbH
Release: 01/21/20
Board: Dlink-DIR880L

I wanted to remove this as my router is public-facing, and it might not be the best practice to expose your system info from a security stand-point.

Solution1

stopservice sshd && echo -e "Your message here\n" > /tmp/loginprompt && startservice sshd

This one-liner is fairly self-explanatory: it stops sshd and overwrite /tmp/loginprompt with your desired message, and before starting sshd again.

$ ssh root@10.0.0.100
Your message here
==========================================================

     ___  ___     _      _____  ______       ____  ___
    / _ \/ _ \___| | /| / / _ \/_  __/ _  __|_  / / _ \
   / // / // /___/ |/ |/ / , _/ / /   | |/ //_ <_/ // /
  /____/____/    |__/|__/_/|_| /_/    |___/____(_)___/

                       DD-WRT v3.0
                   http://www.dd-wrt.com

==========================================================


BusyBox v1.31.1 (2020-01-21 11:19:55 +04) built-in shell (ash)

root@ddwrt:~#

Persisting it for reboots

To make this permanent, under Administration > Commands > Save Startup, save it as a Start Up script.

DD-WRT Commands config tab

DO NOT execute the one-liner in ssh

Executing the one-liner drops the ssh connection immediately, before the startservice sshd part is executed. I learnt this the hard way and locked myself out of my router while I was remote because of this.

? networking
# dd-wrt ssh