The default message that is automatically displayed when a user establishes a SSH connection to a Ubuntu machine is termed as the ‘SSH Banner Message’. The default one would look something like below.
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64) * Documentation: https://help.ubuntu.com/ System information as of Fri Sep 28 09:48:57 UTC 2012 System load: 0.08 Processes: 60 Usage of /: 15.4% of 7.97GB Users logged in: 0 Memory usage: 5% IP address for eth0: 10.143.161.58 Swap usage: 0% Graph this data and manage this system at https://landscape.canonical.com/ 32 packages can be updated. 20 updates are security updates. Last login: Thu Sep 27 19:18:35 2012 from 184.108.40.206 ubuntu@localhost:~$ ls
Perform the below steps if you would like to customize the banner message.
# Open /etc/ssh/sshd_config as superuser. sudo vim /etc/ssh/sshd_config # Find the line that starts with the string ‘#Banner’ and uncomment it. Banner /etc/issue.net # Open /etc/issue.net as sudo and insert the required custom messages. sudo vim /etc/issue.net # If you would prefer to display similar message to the user who may be # logging in on a local console, then update /etc/issue sudo vim /etc/issue # Save the file and restart ‘ssh’ service. sudo service ssh restart
Perform the below steps if you would like to avoid displaying the last login details at the end of the banner message.
# An example of the last login message: Last login: Thu Sep 27 19:18:35 2012 from 220.127.116.11 # To avoid displaying this message - open /etc/ssh/sshd_config as superuser: sudo vim /etc/ssh/sshd_config # Find the line that starts with the string 'PrintLastLog' and update it as: PrintLastLog no # Save the file and restart 'ssh' service. sudo service ssh restart
Follow the below steps if you would like to avoid displaying the the system information details along with the SSH banner.
# The system info details are displayed utilizing the command 'landscape-sysinfo'. For example: ubuntu@localhost:~$ landscape-sysinfo System load: 0.0 Processes: 64 Usage of /: 38.8% of 7.47GB Users logged in: 1 Memory usage: 32% IP address for eth0: 10.0.2.15 Swap usage: 0% Graph this data and manage this system at https://landscape.canonical.com/ ubuntu@localhost:~$ # One of the easiest ways to avoid displaying this information along with SSH banner is to redirect # /etc/motd to a blank file. ubuntu@localhost:~$ ls -l /etc/motd lrwxrwxrwx 1 root root 13 Sep 14 20:13 /etc/motd -> /var/run/motd # Change the link to a blank file. touch ~/blank sudo ln -s ~/blank /etc/motd # Quick tip for advanced users: please note that the command 'landscape-sysinfo' is executed when users # ssh to a machine as a result of /etc/update-motd.d/50-landscape-sysinfo.