Deepak Ojha
Deepak Ojha

Reputation: 35

golang ssh quiet mode

In golang ssh(golang.org/x/crypto/ssh) package how to force the ssh command to use quiet mode i.e. simulate 'ssh -q'

I looked at Config and ClientConfig structures as well as tried searching for 'quiet' or options in the documentation(https://godoc.org/golang.org/x/crypto/ssh) but can't find anything.

Upvotes: 0

Views: 1051

Answers (1)

Deepak Ojha
Deepak Ojha

Reputation: 35

Credits: Thanks to @JimB and @Kenster for nailing this.

Quiet mode is not required for (golang.org/x/crypto/ssh). Extra messages that you would usually see when using a ssh CLI won't appear when using (golang.org/x/crypto/ssh). Here is an example of extra messages:

sshpass -ppassword ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 10.10.10.10 'ls | wc -l'

Warning: Permanently added '10.10.10.10' (ECDSA) to the list of known hosts.

19

sshpass -ppassword ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 10.10.10.10 'ls | wc -l'

19

Upvotes: 1

Related Questions