How to escape a line feed in login banner via CLI?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

How to escape a line feed in login banner via CLI?

L0 Member

What is the escape character/ sequence for LF or CR/LF in cli mode?

Via web interface it is possible to create a multiline login banner with line breaks that looks like the example below.

line 1 test

line 2 login

line 3 banner

This shows up tidy during login via cli and webinterface

$ ssh -l admin 192.168.1.1

line 1 test

line 2 login

line 3 banner

Password:

When configure the set config-output-format show the following code

admin@PA-500# show deviceconfig system

set deviceconfig system login-banner "line 1 test

line 2 login

line 3 banner

"

However, using this code will result into one line only

"line 1 test" and errors Unknown command: line for the remaining lines.

1 accepted solution

Accepted Solutions

Hello Todd,

Unfortunately this issue was never resolved. The only way to implement a 'clean' multiline login banner that shows up with the intended formatting on CLI and GUI login is to create it via web interface.

Thanks

View solution in original post

8 REPLIES 8

L3 Networker

admin@PA-4050# set deviceconfig system login-banner "test <br> test3 <br> test56 <br>"

I am afraid that solves it only for the login via web interface.

Via CLI it results into the following banner:

$ ssh -l admin 192.168.1.1

test<br>test3<br>test56<br>Password:

Thanks

That is because the you are using html so this will only affect the web ui. The ssh session will show you the entire string. If you also want to have this appear via ssh. please login to the web ui --> device --> setup --> configure login banner.

Thank you for the fast answer.

If I want the line breaks to show correctly during CLI login, I have to use the Web UI to configure the login banner?

There is no way to set the same configuration via CLI?

I need check with engineering.

Good morning. Has there been any update on this? I currently have a 10 line login banner I am attempting to script and I have the same result; it all appears on one line.

The following, as entered, errors after the first line (obviously):

set deviceconfig system login-banner "COMPANY networks and systems are assets of the

corporation and are to be used by authorized personnel for

business purposes only.  COMPANY routinely monitors these

systems to protect them from unauthorized use and to

ensure system integrity.  COMPANY is committed to full

compliance with all data privacy laws and requires the same

of its employees.  Individuals suspected of abusing their

access rights are subject to having their activities monitored

and content reviewed."

Removing the "returns" or new line presents this ALL in one line :

"COMPANY networks and systems are assets of the corporation and are to be used by authorized personnel for business purposes only.  COMPANY routinely

monitors these systems to protect them from unauthorized use and to ensure system integrity.  COMPANY is committed to full compliance with all data privacy laws and requires the same of its employees.  Individuals suspected of abusing their access rights are subject to having their activities monitored and content reviewed."

Hello Todd,

Unfortunately this issue was never resolved. The only way to implement a 'clean' multiline login banner that shows up with the intended formatting on CLI and GUI login is to create it via web interface.

Thanks

L0 Member

You can do this with a carriage return (aka CR aka character code 13). I am not really clear when that is a \r or ^M, but this worked on a mac using a iTerm. Now, realize that it is not actually the characters ^ (caret) followed by the letter M, that is only how it shows in the terminal. On a Mac I pressed and held ctrl, then pressed V (released) followed by M (released both ctrl and M). This results in the terminal that looka like the two characters ^M, but is actually a single character on the terminal. I know that is confusing, but long and short, it is not the two characters ^M.

 

Here is an example of how it looks like in the terminal. 

 

admin@pa-220-1# set deviceconfig system login-banner "line 1^Mline 2^Mline 3"

[edit]
admin@pa-220-1# show deviceconfig system
set deviceconfig system login-banner "line 1
line 2
line 3"
[edit]
admin@pa-220-1#

  • 1 accepted solution
  • 7975 Views
  • 8 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!