Welcome, Guest! Registration


Friday, 2019-02-22
Main » 2016 » November » 26 » Suppress ssh warnings
11:02 PM
Suppress ssh warnings

ssh warnings can be extremely annoying, especially when you call ssh from scripts. To disable messages like:

Warning: Permanently added 'remote_host' (RSA) to the list of known hosts.

You can use LogLevel config parameter with value ERROR. Which can easily used right from ssh call command line. Here is an example of perfectly quiet, yet informative output-producing command to be executed from bash, Perl, Python scripts and alike:

ssh -o LogLevel=error -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no remote_host command
or more secure (note StrictHostKeyChecking set to yes):
ssh -o LogLevel=error -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=yes remote_host command

That -o LogLevel=error will leave just normal command output and ssh error messages to be displayed back to the console.

Views: 507 | Added by: ep | Tags: ssh, Linux | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Registration | Login ]