Did you know? You can turn off the banner in Linux or Unix using a particular file. When you log in using ssh or other methods, you will find tons of information on the screen. Here is how my FreeBSD home server login looks:

FreeBSD login banner

Default motd with my hardware and other info

The first one is /etc/motd, and the second is the output of neofetch called from ~/.profile file. And my Ubuntu Linux box showing stuff too when I login using the ssh command:
vivek@localhost's password: 
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-73-generic x86_64)
 
 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
 
  System information as of Saturday 15 May 2021 03:18:53 AM IST
 
  System load:              1.01
  Usage of /:               42.3% of 815.83GB
  Memory usage:             30%
  Swap usage:               0%
  Temperature:              58.0 C
  Processes:                650
  Users logged in:          1
  IPv4 address for br0:     192.168.2.25
  IPv4 address for lxdbr0:  10.83.200.1
  IPv6 address for lxdbr0:  fd42:87d0:ec52:7d50::1
  IPv4 address for mum-wg0: 10.8.0.2
  IPv6 address for mum-wg0: fd9d:bc11:4021::2
  IPv4 address for virbr0:  192.168.122.1
 
3 devices have a firmware upgrade available.
Run `fwupdmgr get-upgrades` for more information.
 
 
1 update can be applied immediately.
To see these additional updates run: apt list --upgradable
 
 
Last login: Sat May 15 03:18:33 2021 from 127.0.0.1

Fear not, there is an easy way to hide this information.

How to turn off login banner in Linux or Unix with .hushlogin

First, create a new empty individual file in your login directory ($HOME) called ~/.hushlogin. At your Linux or Unix shell prompt, type the following touch command:
touch ~/.hushlogin
That is all. Now try login using the ssh command:
ssh vivek@192.168.2.17

What are motd and ~/.hushlogin files?

MOTD is an acronym for a message(s) of the day.

The file /etc/motd is normally displayed by login or ssh after a user has logged in. The contents are displayed before the shell is set up for your session. Traditionally sysadmin used this file to provide system-wide announcements. For instance, they are replacing the RAID array for rebooting the box for kernel upgrades. Here is how to display it using the cat command:
cat /etc/motd
Individual users are allowed to suppress this file’s display by creating a file called .hushlogin in their home directories. The concept of /etc/motd was created as it requires much less disk space than mail to all users.

Turning off the login banner in Linux or Unix using .hushlogin file

touch ~/.hushlogin
#OR#
touch $HOME/.hushlogin
#BASH#
>$HOME/.hushlogin

Demo

Here is a quick video:



Summing up

I explained how to turn off the login banner in Linux, macOS, *BSD, and Unix-like systems. All you have to do is create a file in your $HOME directory. The banner /etc/motd does include essential information about your system, especially downtimes. When you make a ~/.hushlogin file, you will never see such info. But, you can manually see it using the more command or cat command:
more /etc/motd
# freebsd specific #
cat /etc/motd.template
cat /etc/motd*
# Ubuntu #
ls -l /etc/update-motd.d

Please note that Ubuntu Linux uses update-motd file, which is a dynamic MOTD generation tool. See “How to disable ssh motd welcome message on Ubuntu Linux” for more info. Check out motd and login man page by typing the following man command:
man motd
man login


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • Chris May 15, 2021 @ 13:19

    A good reason to turn off the login banner all that extra information is useful thanks for the tutorial.

  • Philip Ndung'u May 16, 2021 @ 19:32

    Very nice article.

    • Raju dada May 24, 2021 @ 19:51

      I agree very useful to have such feature on Ubuntu server.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum