Welcome, Guest! Registration

loc2log

Tuesday, 2024-04-23
Main » 2016 » November » 26

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: 1584 | Added by: ep | Date: 2016-11-25 | Comments (0)