Login banner message


I want to display the message when the user will login to the switch... basically a banner.. can I know what would be the commas to configure the banner message in cumulus Linux? I want user to read the message befor logging in..

14 replies

Userlevel 1
For remote, ssh, login uncomment the "#Banner /etc/issue.net" in /etc/ssh/sshd_config then systemctl reload ssh.

Ciao,
a.
Alberto Furia wrote:

For remote, ssh, login uncomment the "#Banner /etc/issue.net" in /etc/ssh/sshd_config then system...

after un-commenting the #banner in /etc/ssh/sshd_config i am not able to reload the ssh it says access denied..!!

Userlevel 1
Alberto Furia wrote:

For remote, ssh, login uncomment the "#Banner /etc/issue.net" in /etc/ssh/sshd_config then system...

You need do be root.
Try with
sudo systemctl reload ssh
Alberto Furia wrote:

For remote, ssh, login uncomment the "#Banner /etc/issue.net" in /etc/ssh/sshd_config then system...

Yes..!!! I got it.. Thanks Alberto.. 🙂


Userlevel 1
Hi Darshan,

Another option is to add the desired message to /etc/motd.

The contents of this file will be displayed to users upon login via SSH or through the console.
Nick Mitchell wrote:

Hi Darshan,

Another option is to add the desired message to /etc/motd.

The contents of t...

If I enter the message under /etc/issue it will be displayed in the login time right? For example I will mention the message as "warring....!! This switch is authorised only for xyz company " and when used try to login Username : admin Warning.....!! This switch is authorised only for xyz company Password: It will display like mentioned above right?
Userlevel 3
Nick, he wanted it to be pre-login, so it needs to be /etc/issue (or if just ssh, /etc/issue.net and the sshd_config change to match).

Simplest is just use your favorite editor to create /etc/issue, and then write it. Cumulus doesn't edit or install that file, so it will remain as you wrote it, Darshan.
If I enter the message under /etc/issue it will be displayed in the login time right? For example I will mention the message as "warring....!! This switch is authorised only for xyz company " and when used try to login Username : admin Warning.....!! This switch is authorised only for xyz company Password: It will display like mentioned above right?
Userlevel 3
It will be displayed prior to the login prompt. To illustrate:

# cat /etc/issue
Debian GNU/Linux 8 \n \l
# exit
logout
Debian GNU/Linux 8 superm-redxp-02 ttyS0
superm-redxp-02 login:


After modifying:

# cat /etc/issue
Warning!
This switch is authorized only for employees of Cumulus Networks.
# exit
logout
Warning!
This switch is authorized only for employees of Cumulus Networks.
superm-redxp-02 login:

Userlevel 3
If you want it *after* they login, then it's /etc/motd that you want to modify as Nick described, or add a file to /etc/profiled/my-motd.sh similar to the /etc/profile.d/eboot-required-motd.sh script.

To illustrate:
# cat /etc/profile.d/my-motd.sh 
#! /bin/sh
echo -e 'Warning!\nThis system is only for Dave'
# exit
logout
Warning!
This switch is authorized only for employees of Cumulus Networks.
superm-redxp-02 login: root
Password:
Last login: Wed Sep 27 18:07:04 UTC 2017 on ttyS0
Linux superm-redxp-02 4.1.0-cl-6-amd64 #1 SMP Cumulus 4.1.33-1+cl3u10~1506105449.6b5f73b (2017-09-22) x86_64
Welcome to Cumulus (R) Linux (R)
For support and online technical documentation, visit
http://www.cumulusnetworks.com/support
The registered trademark Linux (R) is used pursuant to a sublicense from LMI,
the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide
basis.
Warning!
This system is only for Dave
#
Showing what happens with both /etc/issue and the motd method.

Dave Olson wrote:

If you want it *after* they login, then it's /etc/motd that you want to modify as Nick described,...

Thanks a lot.... I will try this and let you know...
Userlevel 4
Here is an Ansible playbook to configure the pre and post login messages. https://github.com/CumulusNetworks/ansible_snippets/blob/master/basic_ansible/configure_motd.yaml
Along with what Eric mention in the "basic_ansible", you can create a jinja file to fetch information when user login

  OS          : {{ ansible_lsb.codename }} {{ ansible_lsb.release }}
Hostname : {{ ansible_hostname }}
IP address : {{ ansible_eth0.ipv4.address }}
System type : {{ ansible_system }}
Kernel : {{ ansible_kernel }}

Mihir Mehta wrote:

Along with what Eric mention in the "basic_ansible", you can create a jinja file to fetch informa...

Hi Mihir,

This looks strange for me as I am not aware of ansible language..!!

Reply