SSH client option to suppress server banners?

Solution 1:

There is a LogLevel option:

It silences the banner but you're still able to receive errors:

$ ssh -o LogLevel=error localhost 
Permission denied (publickey).

Solution 2:

I 've tested it, I think u can use -q in the ssh command. Parameter -q was means Quiet mode. It causes most warning and diagnostic messages to be suppressed, e.g.

ssh -t '$node2' 'sudo cat xxx' |grep xxxxx" 2>/dev/null >/root/node2

or

ssh -t -q '$node2' 'sudo cat xxxx' |grep xxx" >/root/node2

Hope this can help others


Solution 3:

Update ~/.ssh/config with following to suppress banner

Host *
    LogLevel error

Solution 4:

Seems like you're looking for -q:

Quiet mode. Causes most warning and diagnostic messages to be suppressed.

ssh user@host
*------------------------------------------------------------------------------*
| banner: blah                                                                 |
*------------------------------------------------------------------------------*
Last login: Mon Oct  2 16:40:01 2017 from ipAddress
$

With -q

ssh -q user@host
Last login: Mon Oct  2 16:40:30 2017 from ipAddress
$

Nice and quiet. The banner is still configured but you're not bothered by it.

On another note: don't use banners. It's best not to confirm or deny anything. It won't help you with the people you weren't worried about and the people you are worried about will laugh as they work past it ;-)


Solution 5:

You should be able to set a different Banner (to none) inside a Match block.

For instance:

Match Address 192.0.2.0/24
        Banner none

But this has to be done server-side, based on specific conditions. You can't do it from the client side.

Tags:

Ssh

Banner